* autoload.cc (GetSystemWindowsDirectoryW): Define.
* kernel32.cc (GetWindowsDirectoryW): Implement to abstract from running under Terminal Services or not. (GetWindowsDirectoryA): Ditto.
This commit is contained in:
parent
df54adb746
commit
3e97726f98
|
@ -1,3 +1,10 @@
|
||||||
|
2008-10-22 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
|
* autoload.cc (GetSystemWindowsDirectoryW): Define.
|
||||||
|
* kernel32.cc (GetWindowsDirectoryW): Implement to abstract from
|
||||||
|
running under Terminal Services or not.
|
||||||
|
(GetWindowsDirectoryA): Ditto.
|
||||||
|
|
||||||
2008-10-21 Corinna Vinschen <corinna@vinschen.de>
|
2008-10-21 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
* passwd.cc (pwdgrp::read_passwd): Check if we're called within
|
* passwd.cc (pwdgrp::read_passwd): Check if we're called within
|
||||||
|
|
|
@ -411,6 +411,7 @@ LoadDLLfuncEx (FindFirstVolumeA, 8, kernel32, 1)
|
||||||
LoadDLLfuncEx (FindNextVolumeA, 12, kernel32, 1)
|
LoadDLLfuncEx (FindNextVolumeA, 12, kernel32, 1)
|
||||||
LoadDLLfuncEx (FindVolumeClose, 4, kernel32, 1)
|
LoadDLLfuncEx (FindVolumeClose, 4, kernel32, 1)
|
||||||
LoadDLLfuncEx (GetConsoleWindow, 0, kernel32, 1)
|
LoadDLLfuncEx (GetConsoleWindow, 0, kernel32, 1)
|
||||||
|
LoadDLLfuncEx (GetSystemWindowsDirectoryW, 8, kernel32, 1)
|
||||||
LoadDLLfuncEx (GetVolumeNameForVolumeMountPointA, 12, kernel32, 1)
|
LoadDLLfuncEx (GetVolumeNameForVolumeMountPointA, 12, kernel32, 1)
|
||||||
|
|
||||||
LoadDLLfunc (SHGetDesktopFolder, 4, shell32)
|
LoadDLLfunc (SHGetDesktopFolder, 4, shell32)
|
||||||
|
|
|
@ -11,6 +11,7 @@ details. */
|
||||||
#include "winsup.h"
|
#include "winsup.h"
|
||||||
#include "shared_info.h"
|
#include "shared_info.h"
|
||||||
#include "ntdll.h"
|
#include "ntdll.h"
|
||||||
|
#include <wchar.h>
|
||||||
|
|
||||||
/* Implement CreateEvent/OpenEvent so that named objects are always created in
|
/* Implement CreateEvent/OpenEvent so that named objects are always created in
|
||||||
Cygwin shared object namespace. */
|
Cygwin shared object namespace. */
|
||||||
|
@ -402,3 +403,37 @@ OpenFileMappingA (DWORD dwDesiredAccess, BOOL bInheritHandle, LPCSTR lpName)
|
||||||
}
|
}
|
||||||
return OpenFileMappingW (dwDesiredAccess, bInheritHandle, lpName ? name : NULL);
|
return OpenFileMappingW (dwDesiredAccess, bInheritHandle, lpName ? name : NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* When Terminal Services are installed, the GetWindowsDirectory function
|
||||||
|
does not return the system installation dir, but a user specific directory
|
||||||
|
instead. That's not what we have in mind when calling GetWindowsDirectory
|
||||||
|
from within Cygwin. So we're calling GetSystemWindowsDirectory from here,
|
||||||
|
except on NT4 where we use the method as described in KB186498. */
|
||||||
|
|
||||||
|
#define SYSTEM32 (sizeof ("\\System32") - 1)
|
||||||
|
|
||||||
|
UINT WINAPI
|
||||||
|
GetWindowsDirectoryW (LPWSTR buf, UINT size)
|
||||||
|
{
|
||||||
|
if (wincap.has_terminal_services ())
|
||||||
|
return GetSystemWindowsDirectoryW (buf, size);
|
||||||
|
/* NT4 */
|
||||||
|
WCHAR name [size + SYSTEM32];
|
||||||
|
UINT ret = GetSystemDirectoryW (name, size + SYSTEM32);
|
||||||
|
if (ret < size + SYSTEM32)
|
||||||
|
{
|
||||||
|
name[ret - SYSTEM32] = L'\0';
|
||||||
|
wcscpy (buf, name);
|
||||||
|
}
|
||||||
|
return ret - SYSTEM32;
|
||||||
|
}
|
||||||
|
|
||||||
|
UINT WINAPI
|
||||||
|
GetWindowsDirectoryA (LPSTR buf, UINT size)
|
||||||
|
{
|
||||||
|
WCHAR name[MAX_PATH];
|
||||||
|
UINT ret = GetWindowsDirectoryW (name, min (size, MAX_PATH));
|
||||||
|
if (ret < size)
|
||||||
|
sys_wcstombs (buf, size, name);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue