Hi,
I want to change UnmapViewOfFile() (in kernel) to take a LPCVOID, as per the SDK. To do that, I first need to constify one of the parameters of NtUnmapViewOfSection() (in ntdll), but changing it from PVOID to PCVOID in winternl.h breaks compilation (in the "make depend" stage), thus:
In file included from ../../include/thread.h:29, from relay.c:30: ../../include/winternl.h:1933: error: expected declaration specifiers or ... before PCVOID make[2]: *** [relay.o] Error 1 make[1]: *** [winebuild] Error 2 make: *** [tools] Error 2
What am I doing wrong, please? The patch I want to submit is as follows:
Changelog: ntdll: Constify a formal parameter.
diff -urN a/dlls/ntdll/virtual.c b/dlls/ntdll/virtual.c --- a/dlls/ntdll/virtual.c 2006-07-31 17:30:58.000000000 +0100 +++ b/dlls/ntdll/virtual.c 2006-09-06 15:04:25.000000000 +0100 @@ -1925,7 +1925,7 @@ * NtUnmapViewOfSection (NTDLL.@) * ZwUnmapViewOfSection (NTDLL.@) */ -NTSTATUS WINAPI NtUnmapViewOfSection( HANDLE process, PVOID addr ) +NTSTATUS WINAPI NtUnmapViewOfSection( HANDLE process, PCVOID addr ) { FILE_VIEW *view; NTSTATUS status = STATUS_INVALID_PARAMETER; diff -urN a/include/winternl.h b/include/winternl.h --- a/include/winternl.h 2006-08-04 17:17:26.000000000 +0100 +++ b/include/winternl.h 2006-09-06 14:57:29.000000000 +0100 @@ -1930,7 +1930,7 @@ NTSTATUS WINAPI NtUnloadKeyEx(POBJECT_ATTRIBUTES,HANDLE); NTSTATUS WINAPI NtUnlockFile(HANDLE,PIO_STATUS_BLOCK,PLARGE_INTEGER,PLARGE_INTEGER,PULONG); NTSTATUS WINAPI NtUnlockVirtualMemory(HANDLE,PVOID*,SIZE_T*,ULONG); -NTSTATUS WINAPI NtUnmapViewOfSection(HANDLE,PVOID); +NTSTATUS WINAPI NtUnmapViewOfSection(HANDLE,PCVOID); NTSTATUS WINAPI NtVdmControl(ULONG,PVOID); NTSTATUS WINAPI NtWaitForSingleObject(HANDLE,BOOLEAN,const LARGE_INTEGER*); NTSTATUS WINAPI NtWaitForMultipleObjects(ULONG,const HANDLE*,BOOLEAN,BOOLEAN,const LARGE_INTEGER*);
Thanks,
-- Andy.
I also note that I need to change the equivalent Zw... function, too, but doing so, is not enough to solve the problem.
-- Andy.
"Andrew Talbot" Andrew.Talbot@talbotville.com wrote:
In file included from ../../include/thread.h:29, from relay.c:30: ../../include/winternl.h:1933: error: expected declaration specifiers or ... before PCVOID make[2]: *** [relay.o] Error 1 make[1]: *** [winebuild] Error 2 make: *** [tools] Error 2
Use LPCVOID instead of PCVOID.
Dmitry Timoshkov wrote:
"Andrew Talbot" Andrew.Talbot@talbotville.com wrote:
In file included from ../../include/thread.h:29, from relay.c:30: ../../include/winternl.h:1933: error: expected declaration specifiers or ... before PCVOID make[2]: *** [relay.o] Error 1 make[1]: *** [winebuild] Error 2 make: *** [tools] Error 2
Use LPCVOID instead of PCVOID.
This is ntdll code and LPCVOID is a Win32 type. Don't use Win32 types in ntdll code.
"Robert Shearman" rob@codeweavers.com wrote:
Use LPCVOID instead of PCVOID.
This is ntdll code and LPCVOID is a Win32 type. Don't use Win32 types in ntdll code.
Then simple 'const void *' should do the trick, since introducing PCVOID is not an option (a quick search reveals that it doesn't exist in PSDK).
Dmitry Timoshkov wrote:
"Robert Shearman" rob@codeweavers.com wrote:
Use LPCVOID instead of PCVOID.
This is ntdll code and LPCVOID is a Win32 type. Don't use Win32 types in ntdll code.
Then simple 'const void *' should do the trick, since introducing PCVOID is not an option (a quick search reveals that it doesn't exist in PSDK).
Except that PSDK has it as PVOID. So we should stay away as much as possible from modifying what's in DDK/SDK.
So I'm guessing this one will have to stay the way it is.
Vitaliy.
Vitaliy Margolen wrote:
Dmitry Timoshkov wrote:
"Robert Shearman" rob@codeweavers.com wrote:
Use LPCVOID instead of PCVOID.
This is ntdll code and LPCVOID is a Win32 type. Don't use Win32 types in ntdll code.
Then simple 'const void *' should do the trick, since introducing PCVOID is not an option (a quick search reveals that it doesn't exist in PSDK).
Except that PSDK has it as PVOID. So we should stay away as much as possible from modifying what's in DDK/SDK.
So I'm guessing this one will have to stay the way it is.
Vitaliy.
Thanks to you all! I shall hide my disappointment and move on to the next challenge. :)
-- Andy.