We use SIZE_T throughout the kernel, so I don't understand why change a couple of places (out of thousands) to size_t ? Is there an incompatibility between strsafe headers and that type? Then it would need fixing instead.
Also not sure if that was on purpose, but you also removed null- termination in ex/init.c, but it's not mentioned in the commit message.
WBR, Aleksey Bragin.
On Mar 26, 2011, at 12:42 AM, rharabien@svn.reactos.org wrote:
Author: rharabien Date: Fri Mar 25 21:42:48 2011 New Revision: 51135
URL: http://svn.reactos.org/svn/reactos?rev=51135&view=rev Log: [PSDK] Import strsafe.h from mingw-w64. It's more complete compared to our headers
[DDK] Import ntstrsafe.h from mingw-w64 (converted from strsafe.h). It's more complete compared to our headers
[NTOSKRNL] Use sizeof instead of magic numbers
Let's use strsafe functions now instead of strncpy/wcsncpy, which doesn't always NULL terminate :)
Modified: trunk/reactos/base/applications/notepad/notepad.h trunk/reactos/include/ddk/ntstrsafe.h trunk/reactos/include/psdk/strsafe.h trunk/reactos/ntoskrnl/ex/init.c
[This mail would be too long, it was shortened to contain the URLs only.]
Modified: trunk/reactos/base/applications/notepad/notepad.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/ applications/notepad/notepad.h?rev=51135&r1=51134&r2=51135&view=diff
Modified: trunk/reactos/include/ddk/ntstrsafe.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/include/ddk/ ntstrsafe.h?rev=51135&r1=51134&r2=51135&view=diff
Modified: trunk/reactos/include/psdk/strsafe.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/ strsafe.h?rev=51135&r1=51134&r2=51135&view=diff
Modified: trunk/reactos/ntoskrnl/ex/init.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ex/ init.c?rev=51135&r1=51134&r2=51135&view=diff
We use SIZE_T throughout the kernel, so I don't understand why change a couple of places (out of thousands) to size_t ? Is there an incompatibility between strsafe headers and that type? Then it would need fixing instead.
There is incompatibility. SIZE_T is defined to ULONG_PTH and size_t is unsigned int. I checked it in MSDN too and they have the same definitions. Old ntstrsafe.h API was using SIZE_T but documentation and MS headers use there size_t.
Dnia 26-03-2011 o 10:56:02 Aleksey Bragin aleksey@reactos.org napisał(a):
Also not sure if that was on purpose, but you also removed null- termination in ex/init.c, but it's not mentioned in the commit message.
I didn't remove NULL-termination. Please read correctly. It was moved up to else statement (line 1413) because it's needed only there. Safe string API always NULL-terminates strings.
Best regards, Rafał Harabień
Let me answer this.
Am 26.03.2011 10:56, schrieb Aleksey Bragin:
We use SIZE_T throughout the kernel, so I don't understand why change a couple of places (out of thousands) to size_t ? Is there an incompatibility between strsafe headers and that type? Then it would need fixing instead.
You can thank MS for making size_t an unsigned int, while SIZE_T is an ULONG_PTR aka unsigned long. We can't really fix that.
Also not sure if that was on purpose, but you also removed null-termination in ex/init.c, but it's not mentioned in the commit message.
RtlStringBla always does the null-termination