diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2012-07-06 18:52:33 +0400 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2012-07-06 18:52:33 +0400 |
commit | 9cfc9511cd15f126fe7da4801e65e5afbe7b5486 (patch) | |
tree | 6a4ccb11bb7342b5367af615dedac1205eaf0df8 | |
parent | 3eedbf86113bf48d7e11349439b91fb034f5d1cd (diff) |
* cygpath.cc: Change including headers to allow building against
Mingw64 headers. Include ntdef.h and ntdll.h rather than ddk headers.
Define _WIN32_WINNT and WINVER as 0x0602.
(RtlEqualUnicodePathPrefix): Drop definition. Pulled in from ntdll.h
now.
(get_device_name): s/Zw/Nt.
* dumper.cc: Include sys/param.h
(dumper::dump_memory_region): Use MIN rather than min.
* locale.cc: Include stdlib.h. Define _WIN32_WINNT and WINVER as
0x0602.
* ps.cc: Include ntdef.h and ntdll.h rather than ddk headers.
* regtool.cc (regDeleteKeyEx): Drop WINADVAPI qualifier.
-rw-r--r-- | winsup/utils/ChangeLog | 15 | ||||
-rw-r--r-- | winsup/utils/cygpath.cc | 51 | ||||
-rw-r--r-- | winsup/utils/dumper.cc | 3 | ||||
-rw-r--r-- | winsup/utils/locale.cc | 4 | ||||
-rw-r--r-- | winsup/utils/ps.cc | 6 | ||||
-rw-r--r-- | winsup/utils/regtool.cc | 4 |
6 files changed, 45 insertions, 38 deletions
diff --git a/winsup/utils/ChangeLog b/winsup/utils/ChangeLog index 7adbc9832..e38b51eb6 100644 --- a/winsup/utils/ChangeLog +++ b/winsup/utils/ChangeLog @@ -1,3 +1,18 @@ +2012-07-06 Corinna Vinschen <corinna@vinschen.de> + + * cygpath.cc: Change including headers to allow building against + Mingw64 headers. Include ntdef.h and ntdll.h rather than ddk headers. + Define _WIN32_WINNT and WINVER as 0x0602. + (RtlEqualUnicodePathPrefix): Drop definition. Pulled in from ntdll.h + now. + (get_device_name): s/Zw/Nt. + * dumper.cc: Include sys/param.h + (dumper::dump_memory_region): Use MIN rather than min. + * locale.cc: Include stdlib.h. Define _WIN32_WINNT and WINVER as + 0x0602. + * ps.cc: Include ntdef.h and ntdll.h rather than ddk headers. + * regtool.cc (regDeleteKeyEx): Drop WINADVAPI qualifier. + 2012-06-03 Corinna Vinschen <corinna@vinschen.de> * cygcheck.cc (dump_sysinfo): Change "Server 8" to official diff --git a/winsup/utils/cygpath.cc b/winsup/utils/cygpath.cc index 662112fe5..77ee38426 100644 --- a/winsup/utils/cygpath.cc +++ b/winsup/utils/cygpath.cc @@ -8,10 +8,6 @@ This software is a copyrighted work licensed under the terms of the Cygwin license. Please consult the file "CYGWIN_LICENSE" for details. */ -#define NOCOMATTRIBUTE - -#define WINVER 0x0600 -#include <shlobj.h> #include <stdio.h> #include <string.h> #include <wchar.h> @@ -19,17 +15,22 @@ details. */ #include <stdlib.h> #include <limits.h> #include <getopt.h> -#include <windows.h> -#include <userenv.h> #include <io.h> #include <sys/fcntl.h> #include <sys/cygwin.h> #include <cygwin/version.h> #include <ctype.h> #include <errno.h> -#include <ddk/ntddk.h> -#include <ddk/winddk.h> -#include <ddk/ntifs.h> + +#define _WIN32_WINNT 0x0602 +#define WINVER 0x0602 +#define NOCOMATTRIBUTE +#include <windows.h> +#include <userenv.h> +#include <shlobj.h> +#include <ntdef.h> +#include <ntdll.h> + #include "wide_path.h" #include "loadlib.h" @@ -148,18 +149,6 @@ RtlAllocateUnicodeString (PUNICODE_STRING uni, ULONG size) return uni->Buffer != NULL; } -static inline BOOLEAN -RtlEqualUnicodePathPrefix (PUNICODE_STRING path, PUNICODE_STRING prefix, - BOOLEAN caseinsensitive) - { - UNICODE_STRING p; - - p.Length = p.MaximumLength = prefix->Length < path->Length - ? prefix->Length : path->Length; - p.Buffer = path->Buffer; - return RtlEqualUnicodeString (&p, prefix, caseinsensitive); - } - static size_t my_wcstombs (char *dest, const wchar_t *src, size_t n) { @@ -203,11 +192,11 @@ get_device_name (char *path) query it and use the new name as actual device name to search for in the DOS device name directory. If not, just use the incoming device name. */ InitializeObjectAttributes (&ntobj, &ntdev, OBJ_CASE_INSENSITIVE, NULL, NULL); - status = ZwOpenSymbolicLinkObject (&lnk, SYMBOLIC_LINK_QUERY, &ntobj); + status = NtOpenSymbolicLinkObject (&lnk, SYMBOLIC_LINK_QUERY, &ntobj); if (NT_SUCCESS (status)) { - status = ZwQuerySymbolicLinkObject (lnk, &tgtdev, NULL); - ZwClose (lnk); + status = NtQuerySymbolicLinkObject (lnk, &tgtdev, NULL); + NtClose (lnk); if (!NT_SUCCESS (status)) goto out; RtlCopyUnicodeString (&ntdev, &tgtdev); @@ -225,28 +214,28 @@ get_device_name (char *path) /* Open the directory... */ InitializeObjectAttributes (&ntobj, &ntdevdir, OBJ_CASE_INSENSITIVE, NULL, NULL); - status = ZwOpenDirectoryObject (&dir, DIRECTORY_QUERY, &ntobj); + status = NtOpenDirectoryObject (&dir, DIRECTORY_QUERY, &ntobj); if (!NT_SUCCESS (status)) break; /* ...and scan it. */ for (restart = TRUE, cont = 0; - NT_SUCCESS (ZwQueryDirectoryObject (dir, odi, 4096, TRUE, + NT_SUCCESS (NtQueryDirectoryObject (dir, odi, 4096, TRUE, restart, &cont, NULL)); restart = FALSE) { /* For each entry check if it's a symbolic link. */ InitializeObjectAttributes (&ntobj, &odi->ObjectName, OBJ_CASE_INSENSITIVE, dir, NULL); - status = ZwOpenSymbolicLinkObject (&lnk, SYMBOLIC_LINK_QUERY, &ntobj); + status = NtOpenSymbolicLinkObject (&lnk, SYMBOLIC_LINK_QUERY, &ntobj); if (!NT_SUCCESS (status)) continue; tgtdev.Length = 0; tgtdev.MaximumLength = 512; /* If so, query it and compare the target of the symlink with the incoming device name. */ - status = ZwQuerySymbolicLinkObject (lnk, &tgtdev, NULL); - ZwClose (lnk); + status = NtQuerySymbolicLinkObject (lnk, &tgtdev, NULL); + NtClose (lnk); if (!NT_SUCCESS (status)) continue; if (tgtdev.Length /* There's actually a symlink pointing to an @@ -293,12 +282,12 @@ get_device_name (char *path) else memmove (ret, ret + 4, strlen (ret + 4) + 1); } - ZwClose (dir); + NtClose (dir); goto out; } } } - ZwClose (dir); + NtClose (dir); } out: diff --git a/winsup/utils/dumper.cc b/winsup/utils/dumper.cc index 3b92bcc18..28d0add04 100644 --- a/winsup/utils/dumper.cc +++ b/winsup/utils/dumper.cc @@ -33,6 +33,7 @@ #include <stdio.h> #include <stdlib.h> #include <unistd.h> +#include <sys/param.h> #include <windows.h> #include "dumper.h" @@ -380,7 +381,7 @@ dumper::dump_memory_region (asection * to, process_mem_region * memory) while (size > 0) { - todo = min (size, PAGE_BUFFER_SIZE); + todo = MIN (size, PAGE_BUFFER_SIZE); if (!ReadProcessMemory (hProcess, pos, mem_buf, todo, &done)) { deb_printf ("Failed to read process memory at %x(%x), error %ld\n", pos, todo, GetLastError ()); diff --git a/winsup/utils/locale.cc b/winsup/utils/locale.cc index e3c39c049..be57cf161 100644 --- a/winsup/utils/locale.cc +++ b/winsup/utils/locale.cc @@ -25,6 +25,7 @@ */ #include <errno.h> #include <stdio.h> +#include <stdlib.h> #include <ctype.h> #include <getopt.h> #include <string.h> @@ -34,7 +35,8 @@ #include <limits.h> #include <sys/cygwin.h> #include <cygwin/version.h> -#define WINVER 0x0601 +#define _WIN32_WINNT 0x0602 +#define WINVER 0x0602 #include <windows.h> #define LOCALE_ALIAS "/usr/share/locale/locale.alias" diff --git a/winsup/utils/ps.cc b/winsup/utils/ps.cc index e026518c4..7ed69ea9b 100644 --- a/winsup/utils/ps.cc +++ b/winsup/utils/ps.cc @@ -23,8 +23,8 @@ details. */ #include <sys/cygwin.h> #include <cygwin/version.h> #include <psapi.h> -#include <ddk/ntapi.h> -#include <ddk/winddk.h> +#include <ntdef.h> +#include <ntdll.h> #include "loadlib.h" /* Maximum possible path length under NT. There's no official define @@ -347,7 +347,7 @@ main (int argc, char *argv[]) unicode_buf to have enough space for a maximum sized UNICODE_STRING. */ if (uni->Length == 0) /* System process */ - win32path = L"System"; + win32path = (wchar_t *) L"System"; else { uni->Buffer[uni->Length / sizeof (WCHAR)] = L'\0'; diff --git a/winsup/utils/regtool.cc b/winsup/utils/regtool.cc index cc28d485e..5a4244e3e 100644 --- a/winsup/utils/regtool.cc +++ b/winsup/utils/regtool.cc @@ -574,7 +574,7 @@ cmd_add () } extern "C" { -WINADVAPI LONG WINAPI (*regDeleteKeyEx)(HKEY, LPCWSTR, REGSAM, DWORD); + LONG WINAPI (*regDeleteKeyEx)(HKEY, LPCWSTR, REGSAM, DWORD); } int @@ -587,7 +587,7 @@ cmd_remove () { HMODULE mod = LoadLibrary ("advapi32.dll"); if (mod) - regDeleteKeyEx = (WINADVAPI LONG WINAPI (*)(HKEY, LPCWSTR, REGSAM, DWORD)) GetProcAddress (mod, "RegDeleteKeyExW"); + regDeleteKeyEx = (LONG WINAPI (*)(HKEY, LPCWSTR, REGSAM, DWORD)) GetProcAddress (mod, "RegDeleteKeyExW"); } if (regDeleteKeyEx) rv = (*regDeleteKeyEx) (key, value, wow64, 0); |