Wine-devel
Threads by month
- ----- 2026 -----
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2003 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2002 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2001 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
December 2020
- 68 participants
- 416 discussions
[PATCH v2] user32: No need to change the z-order of the foreground window.
by Haoyang Chen 04 Dec '20
by Haoyang Chen 04 Dec '20
04 Dec '20
1
0
Signed-off-by: Michael Stefaniuc <mstefani(a)winehq.org>
---
dlls/localspl/localmon.c | 90 +++++--------------
dlls/localspl/provider.c | 183 ++++++++++++++-------------------------
2 files changed, 89 insertions(+), 184 deletions(-)
diff --git a/dlls/localspl/localmon.c b/dlls/localspl/localmon.c
index e634a332536..19a74566503 100644
--- a/dlls/localspl/localmon.c
+++ b/dlls/localspl/localmon.c
@@ -78,52 +78,8 @@ typedef struct {
static struct list port_handles = LIST_INIT( port_handles );
static struct list xcv_handles = LIST_INIT( xcv_handles );
-/* ############################### */
-
-static const WCHAR cmd_AddPortW[] = {'A','d','d','P','o','r','t',0};
-static const WCHAR cmd_DeletePortW[] = {'D','e','l','e','t','e','P','o','r','t',0};
-static const WCHAR cmd_ConfigureLPTPortCommandOKW[] = {'C','o','n','f','i','g','u','r','e',
- 'L','P','T','P','o','r','t',
- 'C','o','m','m','a','n','d','O','K',0};
-
-static const WCHAR cmd_GetDefaultCommConfigW[] = {'G','e','t',
- 'D','e','f','a','u','l','t',
- 'C','o','m','m','C','o','n','f','i','g',0};
-
-static const WCHAR cmd_GetTransmissionRetryTimeoutW[] = {'G','e','t',
- 'T','r','a','n','s','m','i','s','s','i','o','n',
- 'R','e','t','r','y','T','i','m','e','o','u','t',0};
-
-static const WCHAR cmd_MonitorUIW[] = {'M','o','n','i','t','o','r','U','I',0};
-static const WCHAR cmd_PortIsValidW[] = {'P','o','r','t','I','s','V','a','l','i','d',0};
-static const WCHAR cmd_SetDefaultCommConfigW[] = {'S','e','t',
- 'D','e','f','a','u','l','t',
- 'C','o','m','m','C','o','n','f','i','g',0};
-
-static const WCHAR dllnameuiW[] = {'l','o','c','a','l','u','i','.','d','l','l',0};
-static const WCHAR emptyW[] = {0};
-static const WCHAR LocalPortW[] = {'L','o','c','a','l',' ','P','o','r','t',0};
-
-static const WCHAR portname_LPT[] = {'L','P','T',0};
-static const WCHAR portname_COM[] = {'C','O','M',0};
-static const WCHAR portname_FILE[] = {'F','I','L','E',':',0};
-static const WCHAR portname_CUPS[] = {'C','U','P','S',':',0};
-static const WCHAR portname_LPR[] = {'L','P','R',':',0};
-
-static const WCHAR TransmissionRetryTimeoutW[] = {'T','r','a','n','s','m','i','s','s','i','o','n',
- 'R','e','t','r','y','T','i','m','e','o','u','t',0};
-
-static const WCHAR WinNT_CV_PortsW[] = {'S','o','f','t','w','a','r','e','\\',
- 'M','i','c','r','o','s','o','f','t','\\',
- 'W','i','n','d','o','w','s',' ','N','T','\\',
- 'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\',
- 'P','o','r','t','s',0};
-
-static const WCHAR WinNT_CV_WindowsW[] = {'S','o','f','t','w','a','r','e','\\',
- 'M','i','c','r','o','s','o','f','t','\\',
- 'W','i','n','d','o','w','s',' ','N','T','\\',
- 'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\',
- 'W','i','n','d','o','w','s',0};
+static const WCHAR WinNT_CV_PortsW[] = L"Software\\Microsoft\\Windows NT\\CurrentVersion\\Ports";
+static const WCHAR WinNT_CV_WindowsW[] = L"Software\\Microsoft\\Windows NT\\CurrentVersion\\Windows";
/******************************************************************
@@ -279,13 +235,13 @@ static DWORD get_type_from_name(LPCWSTR name)
{
HANDLE hfile;
- if (!wcsncmp(name, portname_LPT, ARRAY_SIZE(portname_LPT) - 1))
+ if (!wcsncmp(name, L"LPT", ARRAY_SIZE(L"LPT") - 1))
return PORT_IS_LPT;
- if (!wcsncmp(name, portname_COM, ARRAY_SIZE(portname_COM) - 1))
+ if (!wcsncmp(name, L"COM", ARRAY_SIZE(L"COM") - 1))
return PORT_IS_COM;
- if (!lstrcmpW(name, portname_FILE))
+ if (!lstrcmpW(name, L"FILE:"))
return PORT_IS_FILE;
if (name[0] == '/')
@@ -294,10 +250,10 @@ static DWORD get_type_from_name(LPCWSTR name)
if (name[0] == '|')
return PORT_IS_PIPE;
- if (!wcsncmp(name, portname_CUPS, ARRAY_SIZE(portname_CUPS) - 1))
+ if (!wcsncmp(name, L"CUPS:", ARRAY_SIZE(L"CUPS:") - 1))
return PORT_IS_CUPS;
- if (!wcsncmp(name, portname_LPR, ARRAY_SIZE(portname_LPR) - 1))
+ if (!wcsncmp(name, L"LPR:", ARRAY_SIZE(L"LPR:") - 1))
return PORT_IS_LPR;
/* Must be a file or a directory. Does the file exist ? */
@@ -385,7 +341,7 @@ static BOOL WINAPI localmon_AddPortExW(LPWSTR pName, DWORD level, LPBYTE pBuffer
debugstr_w(pMonitorName), debugstr_w(pi ? pi->pName : NULL));
- if ((pMonitorName == NULL) || (lstrcmpiW(pMonitorName, LocalPortW) != 0 ) ||
+ if ((pMonitorName == NULL) || (lstrcmpiW(pMonitorName, L"Local Port") != 0 ) ||
(pi == NULL) || (pi->pName == NULL) || (pi->pName[0] == '\0') ) {
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
@@ -404,7 +360,7 @@ static BOOL WINAPI localmon_AddPortExW(LPWSTR pName, DWORD level, LPBYTE pBuffer
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
- res = RegSetValueExW(hroot, pi->pName, 0, REG_SZ, (const BYTE *) emptyW, sizeof(emptyW));
+ res = RegSetValueExW(hroot, pi->pName, 0, REG_SZ, (const BYTE *) L"", sizeof(L""));
RegCloseKey(hroot);
}
if (res != ERROR_SUCCESS) SetLastError(ERROR_INVALID_PARAMETER);
@@ -605,7 +561,7 @@ static DWORD WINAPI localmon_XcvDataPort(HANDLE hXcv, LPCWSTR pszDataName, PBYTE
TRACE("(%p, %s, %p, %d, %p, %d, %p)\n", hXcv, debugstr_w(pszDataName),
pInputData, cbInputData, pOutputData, cbOutputData, pcbOutputNeeded);
- if (!lstrcmpW(pszDataName, cmd_AddPortW)) {
+ if (!lstrcmpW(pszDataName, L"AddPort")) {
TRACE("InputData (%d): %s\n", cbInputData, debugstr_w( (LPWSTR) pInputData));
res = RegOpenKeyW(HKEY_LOCAL_MACHINE, WinNT_CV_PortsW, &hroot);
if (res == ERROR_SUCCESS) {
@@ -614,7 +570,7 @@ static DWORD WINAPI localmon_XcvDataPort(HANDLE hXcv, LPCWSTR pszDataName, PBYTE
TRACE("=> %u\n", ERROR_ALREADY_EXISTS);
return ERROR_ALREADY_EXISTS;
}
- res = RegSetValueExW(hroot, (LPWSTR) pInputData, 0, REG_SZ, (const BYTE *) emptyW, sizeof(emptyW));
+ res = RegSetValueExW(hroot, (LPWSTR)pInputData, 0, REG_SZ, (const BYTE*)L"", sizeof(L""));
RegCloseKey(hroot);
}
TRACE("=> %u\n", res);
@@ -622,17 +578,17 @@ static DWORD WINAPI localmon_XcvDataPort(HANDLE hXcv, LPCWSTR pszDataName, PBYTE
}
- if (!lstrcmpW(pszDataName, cmd_ConfigureLPTPortCommandOKW)) {
+ if (!lstrcmpW(pszDataName, L"ConfigureLPTPortCommandOK")) {
TRACE("InputData (%d): %s\n", cbInputData, debugstr_w( (LPWSTR) pInputData));
res = RegCreateKeyW(HKEY_LOCAL_MACHINE, WinNT_CV_WindowsW, &hroot);
if (res == ERROR_SUCCESS) {
- res = RegSetValueExW(hroot, TransmissionRetryTimeoutW, 0, REG_SZ, pInputData, cbInputData);
+ res = RegSetValueExW(hroot, L"TransmissionRetryTimeout", 0, REG_SZ, pInputData, cbInputData);
RegCloseKey(hroot);
}
return res;
}
- if (!lstrcmpW(pszDataName, cmd_DeletePortW)) {
+ if (!lstrcmpW(pszDataName, L"DeletePort")) {
TRACE("InputData (%d): %s\n", cbInputData, debugstr_w( (LPWSTR) pInputData));
res = RegOpenKeyW(HKEY_LOCAL_MACHINE, WinNT_CV_PortsW, &hroot);
if (res == ERROR_SUCCESS) {
@@ -644,7 +600,7 @@ static DWORD WINAPI localmon_XcvDataPort(HANDLE hXcv, LPCWSTR pszDataName, PBYTE
return ERROR_FILE_NOT_FOUND;
}
- if (!lstrcmpW(pszDataName, cmd_GetDefaultCommConfigW)) {
+ if (!lstrcmpW(pszDataName, L"GetDefaultCommConfig")) {
TRACE("InputData (%d): %s\n", cbInputData, debugstr_w( (LPWSTR) pInputData));
*pcbOutputNeeded = cbOutputData;
res = GetDefaultCommConfigW((LPWSTR) pInputData, (LPCOMMCONFIG) pOutputData, pcbOutputNeeded);
@@ -652,7 +608,7 @@ static DWORD WINAPI localmon_XcvDataPort(HANDLE hXcv, LPCWSTR pszDataName, PBYTE
return res ? ERROR_SUCCESS : GetLastError();
}
- if (!lstrcmpW(pszDataName, cmd_GetTransmissionRetryTimeoutW)) {
+ if (!lstrcmpW(pszDataName, L"GetTransmissionRetryTimeout")) {
* pcbOutputNeeded = sizeof(DWORD);
if (cbOutputData >= sizeof(DWORD)) {
/* the w2k resource kit documented a default of 90, but that's wrong */
@@ -661,7 +617,7 @@ static DWORD WINAPI localmon_XcvDataPort(HANDLE hXcv, LPCWSTR pszDataName, PBYTE
res = RegOpenKeyW(HKEY_LOCAL_MACHINE, WinNT_CV_WindowsW, &hroot);
if (res == ERROR_SUCCESS) {
needed = sizeof(buffer) - sizeof(WCHAR);
- res = RegQueryValueExW(hroot, TransmissionRetryTimeoutW, NULL, NULL, (LPBYTE) buffer, &needed);
+ res = RegQueryValueExW(hroot, L"TransmissionRetryTimeout", NULL, NULL, (BYTE*)buffer, &needed);
if ((res == ERROR_SUCCESS) && (buffer[0])) {
*((LPDWORD) pOutputData) = wcstoul(buffer, NULL, 0);
}
@@ -673,16 +629,16 @@ static DWORD WINAPI localmon_XcvDataPort(HANDLE hXcv, LPCWSTR pszDataName, PBYTE
}
- if (!lstrcmpW(pszDataName, cmd_MonitorUIW)) {
- * pcbOutputNeeded = sizeof(dllnameuiW);
- if (cbOutputData >= sizeof(dllnameuiW)) {
- memcpy(pOutputData, dllnameuiW, sizeof(dllnameuiW));
+ if (!lstrcmpW(pszDataName, L"MonitorUI")) {
+ * pcbOutputNeeded = sizeof(L"localui.dll");
+ if (cbOutputData >= sizeof(L"localui.dll")) {
+ memcpy(pOutputData, L"localui.dll", sizeof(L"localui.dll"));
return ERROR_SUCCESS;
}
return ERROR_INSUFFICIENT_BUFFER;
}
- if (!lstrcmpW(pszDataName, cmd_PortIsValidW)) {
+ if (!lstrcmpW(pszDataName, L"PortIsValid")) {
TRACE("InputData (%d): %s\n", cbInputData, debugstr_w( (LPWSTR) pInputData));
res = get_type_from_name((LPCWSTR) pInputData);
TRACE("detected as %u\n", res);
@@ -694,7 +650,7 @@ static DWORD WINAPI localmon_XcvDataPort(HANDLE hXcv, LPCWSTR pszDataName, PBYTE
return GetLastError();
}
- if (!lstrcmpW(pszDataName, cmd_SetDefaultCommConfigW)) {
+ if (!lstrcmpW(pszDataName, L"SetDefaultCommConfig")) {
/* get the portname from the Handle */
ptr = wcschr(((xcv_t *)hXcv)->nameW, ' ');
if (ptr) {
diff --git a/dlls/localspl/provider.c b/dlls/localspl/provider.c
index 326313d8f0c..93a457ab0ba 100644
--- a/dlls/localspl/provider.c
+++ b/dlls/localspl/provider.c
@@ -101,78 +101,27 @@ static monitor_t * pm_localport;
static const PRINTPROVIDOR * pprovider = NULL;
-static const WCHAR backslashW[] = {'\\',0};
-static const WCHAR bs_ports_bsW[] = {'\\','P','o','r','t','s','\\',0};
-static const WCHAR configuration_fileW[] = {'C','o','n','f','i','g','u','r','a','t','i','o','n',' ','F','i','l','e',0};
-static const WCHAR datatypeW[] = {'D','a','t','a','t','y','p','e',0};
-static const WCHAR data_fileW[] = {'D','a','t','a',' ','F','i','l','e',0};
-static const WCHAR dependent_filesW[] = {'D','e','p','e','n','d','e','n','t',' ','F','i','l','e','s',0};
-static const WCHAR driverW[] = {'D','r','i','v','e','r',0};
-static const WCHAR emptyW[] = {0};
-static const WCHAR fmt_driversW[] = { 'S','y','s','t','e','m','\\',
- 'C','u', 'r','r','e','n','t','C','o','n','t','r','o','l','S','e','t','\\',
- 'c','o','n','t','r','o','l','\\',
- 'P','r','i','n','t','\\',
- 'E','n','v','i','r','o','n','m','e','n','t','s','\\',
- '%','s','\\','D','r','i','v','e','r','s','%','s',0 };
-static const WCHAR fmt_printprocessorsW[] = { 'S','y','s','t','e','m','\\',
- 'C','u', 'r','r','e','n','t','C','o','n','t','r','o','l','S','e','t','\\',
- 'C','o','n','t','r','o','l','\\',
- 'P','r','i','n','t','\\',
- 'E','n','v','i','r','o','n','m','e','n','t','s','\\','%','s','\\',
- 'P','r','i','n','t',' ','P','r','o','c','e','s','s','o','r','s',0 };
-static const WCHAR help_fileW[] = {'H','e','l','p',' ','F','i','l','e',0};
-static const WCHAR ia64_envnameW[] = {'W','i','n','d','o','w','s',' ','I','A','6','4',0};
-static const WCHAR ia64_subdirW[] = {'i','a','6','4',0};
-static const WCHAR localportW[] = {'L','o','c','a','l',' ','P','o','r','t',0};
-static const WCHAR monitorW[] = {'M','o','n','i','t','o','r',0};
-static const WCHAR monitorsW[] = {'S','y','s','t','e','m','\\',
- 'C','u', 'r','r','e','n','t','C','o','n','t','r','o','l','S','e','t','\\',
- 'C','o','n','t','r','o','l','\\',
- 'P','r','i','n','t','\\',
- 'M','o','n','i','t','o','r','s','\\',0};
-static const WCHAR monitorUIW[] = {'M','o','n','i','t','o','r','U','I',0};
-static const WCHAR previous_namesW[] = {'P','r','e','v','i','o','u','s',' ','N','a','m','e','s',0};
-static const WCHAR printersW[] = {'S','y','s','t','e','m','\\',
- 'C','u', 'r','r','e','n','t','C','o','n','t','r','o','l','S','e','t','\\',
- 'C','o','n','t','r','o','l','\\',
- 'P','r','i','n','t','\\',
- 'P','r','i','n','t','e','r','s',0};
-static const WCHAR spoolW[] = {'\\','s','p','o','o','l',0};
-static const WCHAR driversW[] = {'\\','d','r','i','v','e','r','s','\\',0};
-static const WCHAR spoolprtprocsW[] = {'\\','s','p','o','o','l','\\','p','r','t','p','r','o','c','s','\\',0};
-static const WCHAR version0_regpathW[] = {'\\','V','e','r','s','i','o','n','-','0',0};
-static const WCHAR version0_subdirW[] = {'\\','0',0};
-static const WCHAR version3_regpathW[] = {'\\','V','e','r','s','i','o','n','-','3',0};
-static const WCHAR version3_subdirW[] = {'\\','3',0};
-static const WCHAR versionW[] = {'V','e','r','s','i','o','n',0};
-static const WCHAR win40_envnameW[] = {'W','i','n','d','o','w','s',' ','4','.','0',0};
-static const WCHAR win40_subdirW[] = {'w','i','n','4','0',0};
-static const WCHAR winnt_cv_portsW[] = {'S','o','f','t','w','a','r','e','\\',
- 'M','i','c','r','o','s','o','f','t','\\',
- 'W','i','n','d','o','w','s',' ','N','T','\\',
- 'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\',
- 'P','o','r','t','s',0};
-static const WCHAR winprintW[] = {'w','i','n','p','r','i','n','t',0};
-static const WCHAR x64_envnameW[] = {'W','i','n','d','o','w','s',' ','x','6','4',0};
-static const WCHAR x64_subdirW[] = {'x','6','4',0};
-static const WCHAR x86_envnameW[] = {'W','i','n','d','o','w','s',' ','N','T',' ','x','8','6',0};
-static const WCHAR x86_subdirW[] = {'w','3','2','x','8','6',0};
-static const WCHAR XcvMonitorW[] = {',','X','c','v','M','o','n','i','t','o','r',' ',0};
-static const WCHAR XcvPortW[] = {',','X','c','v','P','o','r','t',' ',0};
-
-
-static const printenv_t env_ia64 = {ia64_envnameW, ia64_subdirW, 3,
- version3_regpathW, version3_subdirW};
-
-static const printenv_t env_x86 = {x86_envnameW, x86_subdirW, 3,
- version3_regpathW, version3_subdirW};
-
-static const printenv_t env_x64 = {x64_envnameW, x64_subdirW, 3,
- version3_regpathW, version3_subdirW};
-
-static const printenv_t env_win40 = {win40_envnameW, win40_subdirW, 0,
- version0_regpathW, version0_subdirW};
+static const WCHAR fmt_driversW[] =
+ L"System\\CurrentControlSet\\control\\Print\\Environments\\%s\\Drivers%s";
+static const WCHAR fmt_printprocessorsW[] =
+ L"System\\CurrentControlSet\\Control\\Print\\Environments\\%s\\Print Processors";
+static const WCHAR monitorsW[] = L"System\\CurrentControlSet\\Control\\Print\\Monitors\\";
+static const WCHAR printersW[] = L"System\\CurrentControlSet\\Control\\Print\\Printers";
+static const WCHAR winnt_cv_portsW[] = L"Software\\Microsoft\\Windows NT\\CurrentVersion\\Ports";
+static const WCHAR x86_envnameW[] = L"Windows NT x86";
+
+
+static const printenv_t env_ia64 = {L"Windows IA64", L"ia64", 3,
+ L"\\Version-3", L"\\3"};
+
+static const printenv_t env_x86 = {x86_envnameW, L"w32x86", 3,
+ L"\\Version-3", L"\\3"};
+
+static const printenv_t env_x64 = {L"Windows x64", L"x64", 3,
+ L"\\Version-3", L"\\3"};
+
+static const printenv_t env_win40 = {L"Windows 4.0", L"win40", 0,
+ L"\\Version-0", L"\\0"};
static const printenv_t * const all_printenv[] = {&env_x86, &env_x64, &env_ia64, &env_win40};
@@ -515,10 +464,10 @@ static monitor_t * monitor_load(LPCWSTR name, LPWSTR dllname)
/* Get the Driver from the Registry */
if (driver == NULL) {
DWORD namesize;
- if (RegQueryValueExW(hroot, driverW, NULL, NULL, NULL,
+ if (RegQueryValueExW(hroot, L"Driver", NULL, NULL, NULL,
&namesize) == ERROR_SUCCESS) {
driver = heap_alloc(namesize);
- RegQueryValueExW(hroot, driverW, NULL, NULL, (LPBYTE) driver, &namesize) ;
+ RegQueryValueExW(hroot, L"Driver", NULL, NULL, (BYTE*)driver, &namesize);
}
}
}
@@ -637,7 +586,7 @@ static monitor_t * monitor_load(LPCWSTR name, LPWSTR dllname)
}
}
cleanup:
- if ((pm_localport == NULL) && (pm != NULL) && (lstrcmpW(pm->name, localportW) == 0)) {
+ if ((pm_localport == NULL) && (pm != NULL) && (lstrcmpW(pm->name, L"Local Port") == 0)) {
pm->refcount++;
pm_localport = pm;
}
@@ -712,12 +661,12 @@ static monitor_t * monitor_loadui(monitor_t * pm)
/* query the userinterface-dllname from the Portmonitor */
/* building (",XcvMonitor %s",pm->name) not needed yet */
if (pm->monitor.pfnXcvOpenPort)
- res = pm->monitor.pfnXcvOpenPort(pm->hmon, emptyW, SERVER_ACCESS_ADMINISTER, &hXcv);
+ res = pm->monitor.pfnXcvOpenPort(pm->hmon, L"", SERVER_ACCESS_ADMINISTER, &hXcv);
else if (pm->old_XcvOpenPort)
- res = pm->old_XcvOpenPort(emptyW, SERVER_ACCESS_ADMINISTER, &hXcv);
+ res = pm->old_XcvOpenPort(L"", SERVER_ACCESS_ADMINISTER, &hXcv);
TRACE("got %u with %p\n", res, hXcv);
if (res) {
- res = pm->monitor.pfnXcvDataPort(hXcv, monitorUIW, NULL, 0, (BYTE *) buffer, sizeof(buffer), &len);
+ res = pm->monitor.pfnXcvDataPort(hXcv, L"MonitorUI", NULL, 0, (BYTE *) buffer, sizeof(buffer), &len);
TRACE("got %u with %s\n", res, debugstr_w(buffer));
if (res == ERROR_SUCCESS) pui = monitor_load(NULL, buffer);
pm->monitor.pfnXcvClosePort(hXcv);
@@ -750,12 +699,12 @@ static monitor_t * monitor_load_by_port(LPCWSTR portname)
if (RegQueryValueExW(hroot, portname, NULL, NULL, NULL, &len) == ERROR_SUCCESS) {
/* found the portname */
RegCloseKey(hroot);
- return monitor_load(localportW, NULL);
+ return monitor_load(L"Local Port", NULL);
}
RegCloseKey(hroot);
}
- len = MAX_PATH + lstrlenW(bs_ports_bsW) + lstrlenW(portname) + 1;
+ len = MAX_PATH + lstrlenW(L"\\Ports\\") + lstrlenW(portname) + 1;
buffer = heap_alloc(len * sizeof(WCHAR));
if (buffer == NULL) return NULL;
@@ -768,7 +717,7 @@ static monitor_t * monitor_load_by_port(LPCWSTR portname)
RegEnumKeyW(hroot, id, buffer, MAX_PATH);
TRACE("testing %s\n", debugstr_w(buffer));
len = lstrlenW(buffer);
- lstrcatW(buffer, bs_ports_bsW);
+ lstrcatW(buffer, L"\\Ports\\");
lstrcatW(buffer, portname);
if (RegOpenKeyW(hroot, buffer, &hport) == ERROR_SUCCESS) {
RegCloseKey(hport);
@@ -895,7 +844,7 @@ static DWORD get_local_monitors(DWORD level, LPBYTE pMonitors, DWORD cbBuf, LPDW
/* The Monitor must have a Driver-DLL */
if (RegOpenKeyExW(hroot, buffer, 0, KEY_READ, &hentry) == ERROR_SUCCESS) {
- if (RegQueryValueExW(hentry, driverW, NULL, NULL, (LPBYTE) dllname, &dllsize) == ERROR_SUCCESS) {
+ if (RegQueryValueExW(hentry, L"Driver", NULL, NULL, (BYTE*)dllname, &dllsize) == ERROR_SUCCESS) {
/* We found a valid DLL for this Monitor. */
TRACE("using Driver: %s\n", debugstr_w(dllname));
}
@@ -977,27 +926,27 @@ static DWORD get_local_printprocessors(LPWSTR regpathW, LPBYTE pPPInfo, DWORD cb
if (RegCreateKeyW(HKEY_LOCAL_MACHINE, regpathW, &hroot) == ERROR_SUCCESS) {
/* add "winprint" first */
numentries++;
- needed = sizeof(PRINTPROCESSOR_INFO_1W) + sizeof(winprintW);
+ needed = sizeof(PRINTPROCESSOR_INFO_1W) + sizeof(L"winprint");
if (pPPInfo && (cbBuf >= needed)){
ppi = (PPRINTPROCESSOR_INFO_1W) pPPInfo;
pPPInfo += sizeof(PRINTPROCESSOR_INFO_1W);
TRACE("%p: writing PRINTPROCESSOR_INFO_1W #%d\n", ppi, numentries);
ppi->pName = ptr;
- lstrcpyW(ptr, winprintW); /* Name of the Print Processor */
- ptr += ARRAY_SIZE(winprintW);
+ lstrcpyW(ptr, L"winprint"); /* Name of the Print Processor */
+ ptr += ARRAY_SIZE(L"winprint");
}
/* Scan all Printprocessor Keys */
while ((RegEnumKeyExW(hroot, index, buffer, &len, NULL, NULL, NULL, NULL) == ERROR_SUCCESS) &&
- (lstrcmpiW(buffer, winprintW) != 0)) {
+ (lstrcmpiW(buffer, L"winprint") != 0)) {
TRACE("PrintProcessor_%d: %s\n", numentries, debugstr_w(buffer));
dllsize = sizeof(dllname);
dllname[0] = '\0';
/* The Print Processor must have a Driver-DLL */
if (RegOpenKeyExW(hroot, buffer, 0, KEY_READ, &hentry) == ERROR_SUCCESS) {
- if (RegQueryValueExW(hentry, driverW, NULL, NULL, (LPBYTE) dllname, &dllsize) == ERROR_SUCCESS) {
+ if (RegQueryValueExW(hentry, L"Driver", NULL, NULL, (BYTE*)dllname, &dllsize) == ERROR_SUCCESS) {
/* We found a valid DLL for this Print Processor */
TRACE("using Driver: %s\n", debugstr_w(dllname));
}
@@ -1214,8 +1163,8 @@ static BOOL WINAPI fpGetPrinterDriverDirectory(LPWSTR pName, LPWSTR pEnvironment
/* GetSystemDirectoryW returns number of WCHAR including the '\0' */
needed = GetSystemDirectoryW(NULL, 0);
/* add the Size for the Subdirectories */
- needed += lstrlenW(spoolW);
- needed += lstrlenW(driversW);
+ needed += lstrlenW(L"\\spool");
+ needed += lstrlenW(L"\\drivers\\");
needed += lstrlenW(env->subdir);
needed *= sizeof(WCHAR); /* return-value is size in Bytes */
@@ -1234,9 +1183,9 @@ static BOOL WINAPI fpGetPrinterDriverDirectory(LPWSTR pName, LPWSTR pEnvironment
GetSystemDirectoryW( dir, cbBuf / sizeof(WCHAR) );
/* add the Subdirectories */
- lstrcatW( dir, spoolW );
+ lstrcatW( dir, L"\\spool" );
CreateDirectoryW( dir, NULL );
- lstrcatW( dir, driversW );
+ lstrcatW( dir, L"\\drivers\\" );
CreateDirectoryW( dir, NULL );
lstrcatW( dir, env->subdir );
CreateDirectoryW( dir, NULL );
@@ -1274,7 +1223,7 @@ static HMODULE driver_load(const printenv_t * env, LPWSTR dllname)
}
lstrcatW(fullname, env->versionsubdir);
- lstrcatW(fullname, backslashW);
+ lstrcatW(fullname, L"\\");
lstrcatW(fullname, dllname);
hui = LoadLibraryW(fullname);
@@ -1344,8 +1293,8 @@ static HANDLE printer_alloc_handle(LPCWSTR name, LPPRINTER_DEFAULTSW pDefault)
printer = NULL;
}
if (printername) {
- len = ARRAY_SIZE(XcvMonitorW) - 1;
- if (wcsncmp(printername, XcvMonitorW, len) == 0) {
+ len = ARRAY_SIZE(L",XcvMonitor ") - 1;
+ if (wcsncmp(printername, L",XcvMonitor ", len) == 0) {
/* OpenPrinter(",XcvMonitor ", ...) detected */
TRACE(",XcvMonitor: %s\n", debugstr_w(&printername[len]));
printer->pm = monitor_load(&printername[len], NULL);
@@ -1358,8 +1307,8 @@ static HANDLE printer_alloc_handle(LPCWSTR name, LPPRINTER_DEFAULTSW pDefault)
}
else
{
- len = ARRAY_SIZE(XcvPortW) - 1;
- if (wcsncmp( printername, XcvPortW, len) == 0) {
+ len = ARRAY_SIZE(L",XcvPort ") - 1;
+ if (wcsncmp( printername, L",XcvPort ", len) == 0) {
/* OpenPrinter(",XcvPort ", ...) detected */
TRACE(",XcvPort: %s\n", debugstr_w(&printername[len]));
printer->pm = monitor_load_by_port(&printername[len]);
@@ -1475,17 +1424,17 @@ static BOOL myAddPrinterDriverEx(DWORD level, LPBYTE pDriverInfo, DWORD dwFileCo
if (env == NULL) return FALSE; /* ERROR_INVALID_ENVIRONMENT */
/* fill the copy-data / get the driverdir */
- len = sizeof(apd.src) - sizeof(version3_subdirW) - sizeof(WCHAR);
+ len = sizeof(apd.src) - sizeof(L"\\3") - sizeof(WCHAR);
if (!fpGetPrinterDriverDirectory(NULL, (LPWSTR) env->envname, 1,
(LPBYTE) apd.src, len, &len)) {
/* Should never fail */
return FALSE;
}
memcpy(apd.dst, apd.src, len);
- lstrcatW(apd.src, backslashW);
+ lstrcatW(apd.src, L"\\");
apd.srclen = lstrlenW(apd.src);
lstrcatW(apd.dst, env->versionsubdir);
- lstrcatW(apd.dst, backslashW);
+ lstrcatW(apd.dst, L"\\");
apd.dstlen = lstrlenW(apd.dst);
apd.copyflags = dwFileCopyFlags;
apd.lazy = lazy;
@@ -1511,30 +1460,30 @@ static BOOL myAddPrinterDriverEx(DWORD level, LPBYTE pDriverInfo, DWORD dwFileCo
RegCloseKey(hroot);
/* Verified with the Adobe PS Driver, that w2k does not use di.Version */
- RegSetValueExW(hdrv, versionW, 0, REG_DWORD, (const BYTE*) &env->driverversion,
+ RegSetValueExW(hdrv, L"Version", 0, REG_DWORD, (const BYTE*) &env->driverversion,
sizeof(DWORD));
file = get_file_part( di.pDriverPath );
- RegSetValueExW( hdrv, driverW, 0, REG_SZ, (LPBYTE)file, (lstrlenW( file ) + 1) * sizeof(WCHAR) );
+ RegSetValueExW( hdrv, L"Driver", 0, REG_SZ, (BYTE*)file, (lstrlenW( file ) + 1) * sizeof(WCHAR) );
apd_copyfile( di.pDriverPath, file, &apd );
file = get_file_part( di.pDataFile );
- RegSetValueExW( hdrv, data_fileW, 0, REG_SZ, (LPBYTE)file, (lstrlenW( file ) + 1) * sizeof(WCHAR) );
+ RegSetValueExW( hdrv, L"Data File", 0, REG_SZ, (BYTE*)file, (lstrlenW( file ) + 1) * sizeof(WCHAR) );
apd_copyfile( di.pDataFile, file, &apd );
file = get_file_part( di.pConfigFile );
- RegSetValueExW( hdrv, configuration_fileW, 0, REG_SZ, (LPBYTE)file, (lstrlenW( file ) + 1) * sizeof(WCHAR) );
+ RegSetValueExW( hdrv, L"Configuration File", 0, REG_SZ, (BYTE*)file, (lstrlenW( file ) + 1) * sizeof(WCHAR) );
apd_copyfile( di.pConfigFile, file, &apd );
/* settings for level 3 */
if (di.pHelpFile)
{
file = get_file_part( di.pHelpFile );
- RegSetValueExW( hdrv, help_fileW, 0, REG_SZ, (LPBYTE)file, (lstrlenW( file ) + 1) * sizeof(WCHAR) );
+ RegSetValueExW( hdrv, L"Help File", 0, REG_SZ, (BYTE*)file, (lstrlenW( file ) + 1) * sizeof(WCHAR) );
apd_copyfile( di.pHelpFile, file, &apd );
}
else
- RegSetValueExW( hdrv, help_fileW, 0, REG_SZ, (const BYTE*)emptyW, sizeof(emptyW) );
+ RegSetValueExW( hdrv, L"Help File", 0, REG_SZ, (const BYTE*)L"", sizeof(L"") );
if (di.pDependentFiles && *di.pDependentFiles)
{
@@ -1551,31 +1500,31 @@ static BOOL myAddPrinterDriverEx(DWORD level, LPBYTE pDriverInfo, DWORD dwFileCo
}
*reg_ptr = 0;
- RegSetValueExW( hdrv, dependent_filesW, 0, REG_MULTI_SZ, (LPBYTE)reg, (reg_ptr - reg + 1) * sizeof(WCHAR) );
+ RegSetValueExW( hdrv, L"Dependent Files", 0, REG_MULTI_SZ, (BYTE*)reg, (reg_ptr - reg + 1) * sizeof(WCHAR) );
HeapFree( GetProcessHeap(), 0, reg );
}
else
- RegSetValueExW(hdrv, dependent_filesW, 0, REG_MULTI_SZ, (const BYTE*)emptyW, sizeof(emptyW));
+ RegSetValueExW(hdrv, L"Dependent Files", 0, REG_MULTI_SZ, (const BYTE*)L"", sizeof(L""));
/* The language-Monitor was already copied by the caller to "%SystemRoot%\system32" */
if (di.pMonitorName)
- RegSetValueExW(hdrv, monitorW, 0, REG_SZ, (LPBYTE) di.pMonitorName,
+ RegSetValueExW(hdrv, L"Monitor", 0, REG_SZ, (BYTE*)di.pMonitorName,
(lstrlenW(di.pMonitorName)+1)* sizeof(WCHAR));
else
- RegSetValueExW(hdrv, monitorW, 0, REG_SZ, (const BYTE*)emptyW, sizeof(emptyW));
+ RegSetValueExW(hdrv, L"Monitor", 0, REG_SZ, (const BYTE*)L"", sizeof(L""));
if (di.pDefaultDataType)
- RegSetValueExW(hdrv, datatypeW, 0, REG_SZ, (LPBYTE) di.pDefaultDataType,
+ RegSetValueExW(hdrv, L"Datatype", 0, REG_SZ, (BYTE*)di.pDefaultDataType,
(lstrlenW(di.pDefaultDataType)+1)* sizeof(WCHAR));
else
- RegSetValueExW(hdrv, datatypeW, 0, REG_SZ, (const BYTE*)emptyW, sizeof(emptyW));
+ RegSetValueExW(hdrv, L"Datatype", 0, REG_SZ, (const BYTE*)L"", sizeof(L""));
/* settings for level 4 */
if (di.pszzPreviousNames)
- RegSetValueExW(hdrv, previous_namesW, 0, REG_MULTI_SZ, (LPBYTE) di.pszzPreviousNames,
+ RegSetValueExW(hdrv, L"Previous Names", 0, REG_MULTI_SZ, (BYTE*)di.pszzPreviousNames,
multi_sz_lenW(di.pszzPreviousNames));
else
- RegSetValueExW(hdrv, previous_namesW, 0, REG_MULTI_SZ, (const BYTE*)emptyW, sizeof(emptyW));
+ RegSetValueExW(hdrv, L"Previous Names", 0, REG_MULTI_SZ, (const BYTE*)L"", sizeof(L""));
if (level > 5) TRACE("level %u for Driver %s is incomplete\n", level, debugstr_w(di.pName));
@@ -1669,7 +1618,7 @@ static BOOL WINAPI fpAddMonitor(LPWSTR pName, DWORD Level, LPBYTE pMonitors)
DWORD namesize = 0;
if ((disposition == REG_OPENED_EXISTING_KEY) &&
- (RegQueryValueExW(hentry, driverW, NULL, NULL, NULL,
+ (RegQueryValueExW(hentry, L"Driver", NULL, NULL, NULL,
&namesize) == ERROR_SUCCESS)) {
TRACE("monitor %s already exists\n", debugstr_w(mi2w->pName));
/* 9x use ERROR_ALREADY_EXISTS */
@@ -1679,7 +1628,7 @@ static BOOL WINAPI fpAddMonitor(LPWSTR pName, DWORD Level, LPBYTE pMonitors)
{
INT len;
len = (lstrlenW(mi2w->pDLLName) +1) * sizeof(WCHAR);
- res = (RegSetValueExW(hentry, driverW, 0, REG_SZ,
+ res = (RegSetValueExW(hentry, L"Driver", 0, REG_SZ,
(LPBYTE) mi2w->pDLLName, len) == ERROR_SUCCESS);
/* Load and initialize the monitor. SetLastError() is called on failure */
@@ -2437,7 +2386,7 @@ static BOOL WINAPI fpGetPrintProcessorDirectory(LPWSTR pName, LPWSTR pEnvironmen
/* GetSystemDirectoryW returns number of WCHAR including the '\0' */
needed = GetSystemDirectoryW(NULL, 0);
/* add the Size for the Subdirectories */
- needed += lstrlenW(spoolprtprocsW);
+ needed += lstrlenW(L"\\spool\\prtprocs\\");
needed += lstrlenW(env->subdir);
needed *= sizeof(WCHAR); /* return-value is size in Bytes */
@@ -2450,7 +2399,7 @@ static BOOL WINAPI fpGetPrintProcessorDirectory(LPWSTR pName, LPWSTR pEnvironmen
GetSystemDirectoryW((LPWSTR) pPPInfo, cbBuf/sizeof(WCHAR));
/* add the Subdirectories */
- lstrcatW((LPWSTR) pPPInfo, spoolprtprocsW);
+ lstrcatW((LPWSTR) pPPInfo, L"\\spool\\prtprocs\\");
lstrcatW((LPWSTR) pPPInfo, env->subdir);
TRACE("==> %s\n", debugstr_w((LPWSTR) pPPInfo));
return TRUE;
--
2.26.2
2
1
1
1
[PATCH vkd3d v2 1/5] vkd3d-shader: Implement an initial pass-through HLSL preprocessor.
by Zebediah Figura 04 Dec '20
by Zebediah Figura 04 Dec '20
04 Dec '20
Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com>
---
v2: quote some autoconf macros, use AS_IF, try to fix out-of-tree builds
.gitignore | 3 +
Makefile.am | 25 +++++-
configure.ac | 6 ++
libs/vkd3d-shader/preproc.h | 33 ++++++++
libs/vkd3d-shader/preproc.l | 99 ++++++++++++++++++++++++
libs/vkd3d-shader/preproc.y | 60 ++++++++++++++
libs/vkd3d-shader/vkd3d_shader_main.c | 16 +++-
libs/vkd3d-shader/vkd3d_shader_private.h | 8 ++
tests/hlsl_d3d12.c | 31 ++++----
9 files changed, 260 insertions(+), 21 deletions(-)
create mode 100644 libs/vkd3d-shader/preproc.h
create mode 100644 libs/vkd3d-shader/preproc.l
create mode 100644 libs/vkd3d-shader/preproc.y
diff --git a/.gitignore b/.gitignore
index 63a9ffc6..b6d29d19 100644
--- a/.gitignore
+++ b/.gitignore
@@ -19,7 +19,10 @@ vkd3d-*.tar.xz
*.log
*.o
*.pc
+*.tab.c
+*.tab.h
*.trs
+*.yy.c
*~
.deps
diff --git a/Makefile.am b/Makefile.am
index 5a6e4dc9..46eacbd9 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -108,6 +108,29 @@ libvkd3d_common_la_SOURCES = \
lib_LTLIBRARIES = libvkd3d-shader.la libvkd3d.la libvkd3d-utils.la
+VKD3D_V_FLEX = $(vkd3d_v_flex_(a)AM_V@)
+vkd3d_v_flex_ = $(vkd3d_v_flex_(a)AM_DEFAULT_V@)
+vkd3d_v_flex_0 = @echo " FLEX " $@;
+vkd3d_v_flex_1 =
+
+VKD3D_V_BISON = $(vkd3d_v_bison_(a)AM_V@)
+vkd3d_v_bison_ = $(vkd3d_v_bison_(a)AM_DEFAULT_V@)
+vkd3d_v_bison_0 = @echo " BISON " $@;
+vkd3d_v_bison_1 =
+
+libs/vkd3d-shader/preproc.yy.c: libs/vkd3d-shader/preproc.l
+ $(VKD3D_V_FLEX)$(FLEX) $(LFLAGS) -o $@ $<
+
+libs/vkd3d-shader/preproc.tab.c libs/vkd3d-shader/preproc.tab.h &: libs/vkd3d-shader/preproc.y
+ $(VKD3D_V_BISON)$(BISON) $(YFLAGS) -d -o $@ $<
+
+BUILT_SOURCES += libs/vkd3d-shader/preproc.tab.h
+
+nodist_libvkd3d_shader_la_SOURCES = \
+ libs/vkd3d-shader/preproc.tab.c \
+ libs/vkd3d-shader/preproc.tab.h \
+ libs/vkd3d-shader/preproc.yy.c
+
libvkd3d_shader_la_SOURCES = \
include/private/list.h \
include/private/rbtree.h \
@@ -122,7 +145,7 @@ libvkd3d_shader_la_SOURCES = \
libs/vkd3d-shader/vkd3d_shader.map \
libs/vkd3d-shader/vkd3d_shader_main.c \
libs/vkd3d-shader/vkd3d_shader_private.h
-libvkd3d_shader_la_CFLAGS = $(AM_CFLAGS) @SPIRV_TOOLS_CFLAGS@
+libvkd3d_shader_la_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/libs/vkd3d-shader @SPIRV_TOOLS_CFLAGS@
libvkd3d_shader_la_LDFLAGS = $(AM_LDFLAGS) -version-info 1:0:0
libvkd3d_shader_la_LIBADD = libvkd3d-common.la @SPIRV_TOOLS_LIBS@
if HAVE_LD_VERSION_SCRIPT
diff --git a/configure.ac b/configure.ac
index 2f22b05f..b7902b63 100644
--- a/configure.ac
+++ b/configure.ac
@@ -30,6 +30,12 @@ AC_PROG_MKDIR_P
VKD3D_PROG_WIDL(3, 20)
AS_IF([test "x$WIDL" = "xno"], [AC_MSG_WARN([widl is required to build header files.])])
+AC_CHECK_PROGS([FLEX], [flex], [none])
+AS_IF([test "$FLEX" = "none"], [AC_MSG_ERROR([no suitable flex found. Please install the 'flex' package.])])
+
+AC_CHECK_PROGS([BISON], [bison], [none])
+AS_IF([test "$BISON" = "none"], [AC_MSG_ERROR([no suitable bison found. Please install the 'bison' package.])])
+
DX_PS_FEATURE([OFF])
DX_INIT_DOXYGEN([vkd3d], [Doxyfile], [doc])
AC_CONFIG_FILES([Doxyfile])
diff --git a/libs/vkd3d-shader/preproc.h b/libs/vkd3d-shader/preproc.h
new file mode 100644
index 00000000..cbd93229
--- /dev/null
+++ b/libs/vkd3d-shader/preproc.h
@@ -0,0 +1,33 @@
+/*
+ * HLSL preprocessor
+ *
+ * Copyright 2020 Zebediah Figura for CodeWeavers
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef __VKD3D_SHADER_PREPROC_H
+#define __VKD3D_SHADER_PREPROC_H
+
+#include "vkd3d_shader_private.h"
+
+struct preproc_ctx
+{
+ void *scanner;
+
+ struct vkd3d_string_buffer buffer;
+};
+
+#endif
diff --git a/libs/vkd3d-shader/preproc.l b/libs/vkd3d-shader/preproc.l
new file mode 100644
index 00000000..1ae43a8d
--- /dev/null
+++ b/libs/vkd3d-shader/preproc.l
@@ -0,0 +1,99 @@
+/*
+ * HLSL preprocessor
+ *
+ * Copyright 2020 Zebediah Figura for CodeWeavers
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+%{
+
+#include "preproc.tab.h"
+
+#define YYSTYPE PREPROC_YYSTYPE
+#define YYLTYPE PREPROC_YYLTYPE
+
+#define YY_DECL static int preproc_lexer_lex(YYSTYPE *yylval_param, YYLTYPE *yylloc_param, yyscan_t yyscanner)
+
+%}
+
+%option 8bit
+%option bison-bridge
+%option bison-locations
+%option extra-type="struct preproc_ctx *"
+%option never-interactive
+%option noinput
+%option nounput
+%option noyywrap
+%option prefix="preproc_yy"
+%option reentrant
+
+WS [ \t]
+
+%%
+
+{WS}+ {}
+. {return T_TEXT;}
+
+%%
+
+int yylex(YYSTYPE *lval, YYLTYPE *lloc, yyscan_t scanner)
+{
+ struct preproc_ctx *ctx = yyget_extra(scanner);
+
+ for (;;)
+ {
+ const char *text;
+ int token;
+
+ if (!(token = preproc_lexer_lex(lval, lloc, scanner)))
+ return PREPROC_YYEOF;
+ text = yyget_text(scanner);
+
+ TRACE("Parsing token %d, string %s.\n", token, debugstr_a(text));
+
+ vkd3d_string_buffer_printf(&ctx->buffer, "%s ", text);
+ }
+}
+
+int preproc_lexer_parse(const struct vkd3d_shader_compile_info *compile_info,
+ struct vkd3d_shader_code *out, struct vkd3d_shader_message_context *message_context)
+{
+ struct preproc_ctx ctx = {0};
+ YY_BUFFER_STATE top_buffer;
+ void *output_code;
+
+ vkd3d_string_buffer_init(&ctx.buffer);
+
+ yylex_init_extra(&ctx, &ctx.scanner);
+ top_buffer = yy_scan_bytes(compile_info->source.code, compile_info->source.size, ctx.scanner);
+
+ preproc_yyparse(ctx.scanner, &ctx);
+
+ yy_delete_buffer(top_buffer, ctx.scanner);
+ yylex_destroy(ctx.scanner);
+
+ if (!(output_code = vkd3d_malloc(ctx.buffer.content_size)))
+ {
+ vkd3d_string_buffer_cleanup(&ctx.buffer);
+ return VKD3D_ERROR_OUT_OF_MEMORY;
+ }
+ memcpy(output_code, ctx.buffer.buffer, ctx.buffer.content_size);
+ out->size = ctx.buffer.content_size;
+ out->code = output_code;
+ vkd3d_string_buffer_trace(&ctx.buffer);
+ vkd3d_string_buffer_cleanup(&ctx.buffer);
+ return VKD3D_OK;
+}
diff --git a/libs/vkd3d-shader/preproc.y b/libs/vkd3d-shader/preproc.y
new file mode 100644
index 00000000..92448f24
--- /dev/null
+++ b/libs/vkd3d-shader/preproc.y
@@ -0,0 +1,60 @@
+/*
+ * HLSL preprocessor
+ *
+ * Copyright 2020 Zebediah Figura for CodeWeavers
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+%code requires
+{
+
+#include "vkd3d_shader_private.h"
+#include "preproc.h"
+
+}
+
+%code provides
+{
+
+int preproc_yylex(PREPROC_YYSTYPE *yylval_param, PREPROC_YYLTYPE *yylloc_param, void *scanner);
+
+}
+
+%code
+{
+
+static void yyerror(const YYLTYPE *loc, void *scanner, struct preproc_ctx *ctx, const char *string)
+{
+ FIXME("Error reporting is not implemented.\n");
+}
+
+}
+
+%define api.prefix {preproc_yy}
+%define api.pure full
+%define parse.error verbose
+%expect 0
+%locations
+%lex-param {yyscan_t scanner}
+%parse-param {void *scanner}
+%parse-param {struct preproc_ctx *ctx}
+
+%token T_TEXT
+
+%%
+
+shader_text
+ : %empty
diff --git a/libs/vkd3d-shader/vkd3d_shader_main.c b/libs/vkd3d-shader/vkd3d_shader_main.c
index 1a029246..eed0316c 100644
--- a/libs/vkd3d-shader/vkd3d_shader_main.c
+++ b/libs/vkd3d-shader/vkd3d_shader_main.c
@@ -78,8 +78,7 @@ int vkd3d_string_buffer_vprintf(struct vkd3d_string_buffer *buffer, const char *
}
}
-static int VKD3D_PRINTF_FUNC(2, 3) vkd3d_string_buffer_printf(struct vkd3d_string_buffer *buffer,
- const char *format, ...)
+int vkd3d_string_buffer_printf(struct vkd3d_string_buffer *buffer, const char *format, ...)
{
va_list args;
int ret;
@@ -91,7 +90,7 @@ static int VKD3D_PRINTF_FUNC(2, 3) vkd3d_string_buffer_printf(struct vkd3d_strin
return ret;
}
-static void vkd3d_string_buffer_trace_(const struct vkd3d_string_buffer *buffer, const char *function)
+void vkd3d_string_buffer_trace_(const struct vkd3d_string_buffer *buffer, const char *function)
{
const char *p, *q, *end = buffer->buffer + buffer->content_size;
@@ -1154,6 +1153,7 @@ const enum vkd3d_shader_target_type *vkd3d_shader_get_supported_target_types(
int vkd3d_shader_preprocess(const struct vkd3d_shader_compile_info *compile_info,
struct vkd3d_shader_code *out, char **messages)
{
+ struct vkd3d_shader_message_context message_context;
int ret;
TRACE("compile_info %p, out %p, messages %p.\n", compile_info, out, messages);
@@ -1164,5 +1164,13 @@ int vkd3d_shader_preprocess(const struct vkd3d_shader_compile_info *compile_info
if ((ret = vkd3d_shader_validate_compile_info(compile_info, false)) < 0)
return ret;
- return VKD3D_ERROR_NOT_IMPLEMENTED;
+ vkd3d_shader_message_context_init(&message_context, compile_info->log_level, compile_info->source_name);
+
+ ret = preproc_lexer_parse(compile_info, out, &message_context);
+
+ vkd3d_shader_message_context_trace_messages(&message_context);
+ if (!vkd3d_shader_message_context_copy_messages(&message_context, messages))
+ ret = VKD3D_ERROR_OUT_OF_MEMORY;
+ vkd3d_shader_message_context_cleanup(&message_context);
+ return ret;
}
diff --git a/libs/vkd3d-shader/vkd3d_shader_private.h b/libs/vkd3d-shader/vkd3d_shader_private.h
index 5ae5724a..83038384 100644
--- a/libs/vkd3d-shader/vkd3d_shader_private.h
+++ b/libs/vkd3d-shader/vkd3d_shader_private.h
@@ -837,6 +837,11 @@ struct vkd3d_string_buffer
enum vkd3d_result vkd3d_dxbc_binary_to_text(void *data, struct vkd3d_shader_code *out) DECLSPEC_HIDDEN;
void vkd3d_string_buffer_cleanup(struct vkd3d_string_buffer *buffer) DECLSPEC_HIDDEN;
void vkd3d_string_buffer_init(struct vkd3d_string_buffer *buffer) DECLSPEC_HIDDEN;
+int vkd3d_string_buffer_printf(struct vkd3d_string_buffer *buffer,
+ const char *format, ...) VKD3D_PRINTF_FUNC(2, 3) DECLSPEC_HIDDEN;
+#define vkd3d_string_buffer_trace(buffer) \
+ vkd3d_string_buffer_trace_(buffer, __FUNCTION__)
+void vkd3d_string_buffer_trace_(const struct vkd3d_string_buffer *buffer, const char *function) DECLSPEC_HIDDEN;
int vkd3d_string_buffer_vprintf(struct vkd3d_string_buffer *buffer, const char *format, va_list args) DECLSPEC_HIDDEN;
struct vkd3d_shader_message_context
@@ -882,6 +887,9 @@ void vkd3d_dxbc_compiler_destroy(struct vkd3d_dxbc_compiler *compiler) DECLSPEC_
void vkd3d_compute_dxbc_checksum(const void *dxbc, size_t size, uint32_t checksum[4]) DECLSPEC_HIDDEN;
+int preproc_lexer_parse(const struct vkd3d_shader_compile_info *compile_info,
+ struct vkd3d_shader_code *out, struct vkd3d_shader_message_context *message_context) DECLSPEC_HIDDEN;
+
static inline enum vkd3d_shader_component_type vkd3d_component_type_from_data_type(
enum vkd3d_data_type data_type)
{
diff --git a/tests/hlsl_d3d12.c b/tests/hlsl_d3d12.c
index 4f4cc37f..787355ba 100644
--- a/tests/hlsl_d3d12.c
+++ b/tests/hlsl_d3d12.c
@@ -30,22 +30,20 @@ static void check_preprocess_(int line, const char *source, const D3D_SHADER_MAC
HRESULT hr;
hr = D3DPreprocess(source, strlen(source), NULL, macros, include, &blob, &errors);
- todo ok_(line)(hr == S_OK, "Failed to preprocess shader, hr %#x.\n", hr);
+ assert_that_(line)(hr == S_OK, "Failed to preprocess shader, hr %#x.\n", hr);
if (errors)
{
if (vkd3d_test_state.debug_level)
trace_(line)("%s\n", (char *)ID3D10Blob_GetBufferPointer(errors));
ID3D10Blob_Release(errors);
}
- if (hr != S_OK)
- return;
code = ID3D10Blob_GetBufferPointer(blob);
size = ID3D10Blob_GetBufferSize(blob);
if (present)
ok_(line)(vkd3d_memmem(code, size, present, strlen(present)),
"\"%s\" not found in preprocessed shader.\n", present);
if (absent)
- ok_(line)(!vkd3d_memmem(code, size, absent, strlen(absent)),
+ assert_that_(line)(!vkd3d_memmem(code, size, absent, strlen(absent)),
"\"%s\" found in preprocessed shader.\n", absent);
ID3D10Blob_Release(blob);
}
@@ -352,7 +350,8 @@ static void test_preprocess(void)
for (i = 0; i < ARRAY_SIZE(tests); ++i)
{
vkd3d_test_set_context("Source \"%s\"", tests[i].source);
- check_preprocess(tests[i].source, NULL, NULL, tests[i].present, tests[i].absent);
+ todo_if (i != 5 && i != 8 && i != 42)
+ check_preprocess(tests[i].source, NULL, NULL, tests[i].present, tests[i].absent);
}
vkd3d_test_set_context(NULL);
@@ -360,16 +359,16 @@ static void test_preprocess(void)
macros[0].Definition = "value";
macros[1].Name = NULL;
macros[1].Definition = NULL;
- check_preprocess("KEY", macros, NULL, "value", "KEY");
+ todo check_preprocess("KEY", macros, NULL, "value", "KEY");
- check_preprocess("#undef KEY\nKEY", macros, NULL, "KEY", "value");
+ todo check_preprocess("#undef KEY\nKEY", macros, NULL, "KEY", "value");
macros[0].Name = NULL;
- check_preprocess("KEY", macros, NULL, "KEY", "value");
+ todo check_preprocess("KEY", macros, NULL, "KEY", "value");
macros[0].Name = "KEY";
macros[0].Definition = NULL;
- check_preprocess("KEY", macros, NULL, NULL, "KEY");
+ todo check_preprocess("KEY", macros, NULL, NULL, "KEY");
macros[0].Name = "0";
macros[0].Definition = "value";
@@ -377,7 +376,7 @@ static void test_preprocess(void)
macros[0].Name = "KEY(a)";
macros[0].Definition = "value";
- check_preprocess("KEY(a)", macros, NULL, "KEY", "value");
+ todo check_preprocess("KEY(a)", macros, NULL, "KEY", "value");
macros[0].Name = "KEY";
macros[0].Definition = "value1";
@@ -385,33 +384,33 @@ static void test_preprocess(void)
macros[1].Definition = "value2";
macros[2].Name = NULL;
macros[2].Definition = NULL;
- check_preprocess("KEY", macros, NULL, "value2", NULL);
+ todo check_preprocess("KEY", macros, NULL, "value2", NULL);
macros[0].Name = "KEY";
macros[0].Definition = "KEY2";
macros[1].Name = "KEY2";
macros[1].Definition = "value";
- check_preprocess("KEY", macros, NULL, "value", NULL);
+ todo check_preprocess("KEY", macros, NULL, "value", NULL);
macros[0].Name = "KEY2";
macros[0].Definition = "value";
macros[1].Name = "KEY";
macros[1].Definition = "KEY2";
- check_preprocess("KEY", macros, NULL, "value", NULL);
+ todo check_preprocess("KEY", macros, NULL, "value", NULL);
- check_preprocess(test_include_top, NULL, &test_include, "pass", "fail");
+ todo check_preprocess(test_include_top, NULL, &test_include, "pass", "fail");
ok(!refcount_file1, "Got %d references to file1.\n", refcount_file1);
ok(!refcount_file2, "Got %d references to file1.\n", refcount_file2);
ok(!refcount_file3, "Got %d references to file1.\n", refcount_file3);
todo ok(include_count_file2 == 2, "file2 was included %u times.\n", include_count_file2);
/* Macro invocation spread across multiple files. */
- check_preprocess(test_include2_top, NULL, &test_include, "pass", NULL);
+ todo check_preprocess(test_include2_top, NULL, &test_include, "pass", NULL);
blob = errors = (ID3D10Blob *)0xdeadbeef;
hr = D3DPreprocess(test_include_top, strlen(test_include_top), NULL, NULL, &test_include_fail, &blob, &errors);
todo ok(hr == E_FAIL, "Got hr %#x.\n", hr);
- ok(blob == (ID3D10Blob *)0xdeadbeef, "Expected no compiled shader blob.\n");
+ todo ok(blob == (ID3D10Blob *)0xdeadbeef, "Expected no compiled shader blob.\n");
todo ok(!!errors, "Expected non-NULL error blob.\n");
if (errors)
{
--
2.29.2
2
9
Signed-off-by: Michael Stefaniuc <mstefani(a)winehq.org>
---
dlls/xmllite/reader.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/dlls/xmllite/reader.c b/dlls/xmllite/reader.c
index 4793b128bae..13d841eb94d 100644
--- a/dlls/xmllite/reader.c
+++ b/dlls/xmllite/reader.c
@@ -213,9 +213,9 @@ typedef struct
static WCHAR emptyW[] = L"";
static WCHAR xmlW[] = L"xml";
static WCHAR xmlnsW[] = L"xmlns";
-static const strval strval_empty = { (WCHAR *)emptyW, 0 };
-static const strval strval_xml = { (WCHAR *)xmlW, 3 };
-static const strval strval_xmlns = { (WCHAR *)xmlnsW, 5 };
+static const strval strval_empty = { emptyW, 0 };
+static const strval strval_xml = { xmlW, 3 };
+static const strval strval_xmlns = { xmlnsW, 5 };
struct reader_position
{
--
2.26.2
2
1
04 Dec '20
Signed-off-by: Michael Stefaniuc <mstefani(a)winehq.org>
---
dlls/xmllite/reader.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/xmllite/reader.c b/dlls/xmllite/reader.c
index a463934202a..4793b128bae 100644
--- a/dlls/xmllite/reader.c
+++ b/dlls/xmllite/reader.c
@@ -210,7 +210,7 @@ typedef struct
UINT start; /* input position where value starts */
} strval;
-static WCHAR emptyW[] = {0};
+static WCHAR emptyW[] = L"";
static WCHAR xmlW[] = L"xml";
static WCHAR xmlnsW[] = L"xmlns";
static const strval strval_empty = { (WCHAR *)emptyW, 0 };
--
2.26.2
2
1
This fixes a crash for me when reallocating "handles", triggered by the mfplat tests.
Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com>
---
dlls/mfplat/main.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/dlls/mfplat/main.c b/dlls/mfplat/main.c
index e4cd1c397ad..54bd70a2fff 100644
--- a/dlls/mfplat/main.c
+++ b/dlls/mfplat/main.c
@@ -8911,14 +8911,12 @@ HRESULT WINAPI MFCreateDXGIDeviceManager(UINT *token, IMFDXGIDeviceManager **man
if (!token || !manager)
return E_POINTER;
- object = heap_alloc(sizeof(*object));
- if (!object)
+ if (!(object = heap_alloc_zero(sizeof(*object))))
return E_OUTOFMEMORY;
object->IMFDXGIDeviceManager_iface.lpVtbl = &dxgi_device_manager_vtbl;
object->refcount = 1;
object->token = GetTickCount();
- object->device = NULL;
InitializeCriticalSection(&object->cs);
InitializeConditionVariable(&object->lock);
--
2.29.2
2
1
[PATCH 00/17] Final patches of the audio converter MFT + the color converter MFT.
by Derek Lesho 03 Dec '20
by Derek Lesho 03 Dec '20
03 Dec '20
I know this is a lot of patches to send at once, but I'm hoping it's reasonable given
1) how similar patches 7-17 are to the audio converter patches.
2) how patches 1-2 were already signed off on, but didn't get applied due to a copyright notice messing up the merge
The reason I didn't split this into two patchsets is that the color converter also relies on gst_buffer_from_mf_sample, provided by patch 3.
With all these plus the two I sent earlier this week, media foundation video in Unreal Engine games works.
Derek Lesho (17):
winegstreamer: Implement ::SetInputType for audio conversion
transform.
winegstreamer: Implement ::SetOutputType for audio conversion
transform.
winegstreamer: Implement ::Process(Input/Output) for audio conversion
transform.
winegstreamer: Implement ::Get(Input/Output)StreamInfo for audio
conversion transform.
winegstreamer: Implement Get*Attributes functions for audio converter
transform.
winegstreamer: Implement Get(Input/Output)CurrentType functions for
audio converter transform.
winegstreamer: Introduce color conversion transform.
winegstreamer: Register the color conversion transform.
winegstreamer: Implement ::GetInputAvailableType for color conversion
transform.
winegstreamer: Implement ::SetInputType for color conversion
transform.
winegstreamer: Implement ::GetOutputAvailableType for color conversion
transform.
winegstreamer: Implement ::SetOutputType for color conversion
transform.
winegstreamer: Implement ::Process(Input/Output) for color conversion
transform.
winegstreamer: Implement ::ProcessMessage for color conversion MFT.
winegstreamer: Implement ::Get(Input/Output)StreamInfo for color
conversion transform.
winegstreamer: Implement Get*Attributes functions for color converter
transform.
winegstreamer: Implement Get(Input/Output)CurrentType functions for
color converter transform.
dlls/winegstreamer/Makefile.in | 1 +
dlls/winegstreamer/audioconvert.c | 437 ++++++++++-
dlls/winegstreamer/colorconvert.c | 778 +++++++++++++++++++
dlls/winegstreamer/gst_private.h | 2 +
dlls/winegstreamer/mfplat.c | 106 ++-
dlls/winegstreamer/winegstreamer_classes.idl | 6 +
6 files changed, 1309 insertions(+), 21 deletions(-)
create mode 100644 dlls/winegstreamer/colorconvert.c
--
2.29.2
3
43
Signed-off-by: Michael Stefaniuc <mstefani(a)winehq.org>
---
dlls/ntdll/atom.c | 3 +-
dlls/ntdll/directory.c | 6 +-
dlls/ntdll/env.c | 138 +++++++++++++----------------------------
dlls/ntdll/loader.c | 107 +++++++++++---------------------
dlls/ntdll/loadorder.c | 24 +++----
dlls/ntdll/locale.c | 8 +--
dlls/ntdll/path.c | 15 ++---
dlls/ntdll/reg.c | 31 ++-------
dlls/ntdll/relay.c | 32 +++-------
dlls/ntdll/rtl.c | 6 +-
dlls/ntdll/rtlstr.c | 20 ++----
dlls/ntdll/sec.c | 7 +--
12 files changed, 123 insertions(+), 274 deletions(-)
diff --git a/dlls/ntdll/atom.c b/dlls/ntdll/atom.c
index fd1f17b6197..8facadbf8f6 100644
--- a/dlls/ntdll/atom.c
+++ b/dlls/ntdll/atom.c
@@ -102,11 +102,10 @@ NTSTATUS WINAPI RtlDeleteAtomFromAtomTable( RTL_ATOM_TABLE table, RTL_ATOM atom
*/
static ULONG integral_atom_name(WCHAR* buffer, ULONG len, RTL_ATOM atom)
{
- static const WCHAR fmt[] = {'#','%','u',0};
WCHAR tmp[16];
int ret;
- ret = swprintf( tmp, ARRAY_SIZE(tmp), fmt, atom );
+ ret = swprintf( tmp, ARRAY_SIZE(tmp), L"#%u", atom );
if (!len) return ret * sizeof(WCHAR);
if (len <= ret) ret = len - 1;
memcpy( buffer, tmp, ret * sizeof(WCHAR) );
diff --git a/dlls/ntdll/directory.c b/dlls/ntdll/directory.c
index 39641e9d4d5..cfb4595d457 100644
--- a/dlls/ntdll/directory.c
+++ b/dlls/ntdll/directory.c
@@ -50,8 +50,6 @@ static BOOL show_dot_files;
*/
void init_directories(void)
{
- static const WCHAR WineW[] = {'S','o','f','t','w','a','r','e','\\','W','i','n','e',0};
- static const WCHAR ShowDotFilesW[] = {'S','h','o','w','D','o','t','F','i','l','e','s',0};
char tmp[80];
HANDLE root, hkey;
DWORD dummy;
@@ -65,12 +63,12 @@ void init_directories(void)
attr.Attributes = 0;
attr.SecurityDescriptor = NULL;
attr.SecurityQualityOfService = NULL;
- RtlInitUnicodeString( &nameW, WineW );
+ RtlInitUnicodeString( &nameW, L"Software\\Wine" );
/* @@ Wine registry key: HKCU\Software\Wine */
if (!NtOpenKey( &hkey, KEY_ALL_ACCESS, &attr ))
{
- RtlInitUnicodeString( &nameW, ShowDotFilesW );
+ RtlInitUnicodeString( &nameW, L"ShowDotFiles" );
if (!NtQueryValueKey( hkey, &nameW, KeyValuePartialInformation, tmp, sizeof(tmp), &dummy ))
{
WCHAR *str = (WCHAR *)((KEY_VALUE_PARTIAL_INFORMATION *)tmp)->Data;
diff --git a/dlls/ntdll/env.c b/dlls/ntdll/env.c
index bf3fedcac67..5d1b6de5bba 100644
--- a/dlls/ntdll/env.c
+++ b/dlls/ntdll/env.c
@@ -33,7 +33,7 @@
WINE_DEFAULT_DEBUG_CHANNEL(environ);
-static WCHAR empty[] = {0};
+static WCHAR empty[] = L"";
static const UNICODE_STRING empty_str = { 0, sizeof(empty), empty };
static const UNICODE_STRING null_str = { 0, 0, NULL };
@@ -76,7 +76,6 @@ static void set_env_var( WCHAR **env, const WCHAR *name, const WCHAR *val )
static void set_registry_variables( WCHAR **env, HANDLE hkey, ULONG type )
{
static const WCHAR pathW[] = {'P','A','T','H'};
- static const WCHAR sep[] = {';',0};
UNICODE_STRING env_name, env_value;
NTSTATUS status;
DWORD size;
@@ -114,7 +113,7 @@ static void set_registry_variables( WCHAR **env, HANDLE hkey, ULONG type )
!wcsnicmp( env_name.Buffer, pathW, ARRAY_SIZE( pathW )) &&
!RtlQueryEnvironmentVariable_U( *env, &env_name, &tmp ))
{
- RtlAppendUnicodeToString( &tmp, sep );
+ RtlAppendUnicodeToString( &tmp, L";" );
if (RtlAppendUnicodeStringToString( &tmp, &env_value )) continue;
RtlCopyUnicodeString( &env_value, &tmp );
}
@@ -137,16 +136,6 @@ static void set_registry_variables( WCHAR **env, HANDLE hkey, ULONG type )
*/
static BOOL set_registry_environment( WCHAR **env, BOOL first_time )
{
- static const WCHAR env_keyW[] = {'\\','R','e','g','i','s','t','r','y','\\',
- 'M','a','c','h','i','n','e','\\',
- 'S','y','s','t','e','m','\\',
- 'C','u','r','r','e','n','t','C','o','n','t','r','o','l','S','e','t','\\',
- 'C','o','n','t','r','o','l','\\',
- 'S','e','s','s','i','o','n',' ','M','a','n','a','g','e','r','\\',
- 'E','n','v','i','r','o','n','m','e','n','t',0};
- static const WCHAR envW[] = {'E','n','v','i','r','o','n','m','e','n','t',0};
- static const WCHAR volatile_envW[] = {'V','o','l','a','t','i','l','e',' ','E','n','v','i','r','o','n','m','e','n','t',0};
-
OBJECT_ATTRIBUTES attr;
UNICODE_STRING nameW;
HANDLE hkey;
@@ -154,7 +143,8 @@ static BOOL set_registry_environment( WCHAR **env, BOOL first_time )
/* first the system environment variables */
InitializeObjectAttributes( &attr, &nameW, 0, 0, NULL );
- RtlInitUnicodeString( &nameW, env_keyW );
+ RtlInitUnicodeString( &nameW, L"\\Registry\\Machine\\System\\CurrentControlSet\\Control\\"
+ "Session Manager\\Environment" );
if (first_time && !NtOpenKey( &hkey, KEY_READ, &attr ))
{
set_registry_variables( env, hkey, REG_SZ );
@@ -165,7 +155,7 @@ static BOOL set_registry_environment( WCHAR **env, BOOL first_time )
/* then the ones for the current user */
if (RtlOpenCurrentUser( KEY_READ, &attr.RootDirectory ) != STATUS_SUCCESS) return ret;
- RtlInitUnicodeString( &nameW, envW );
+ RtlInitUnicodeString( &nameW, L"Environment" );
if (first_time && !NtOpenKey( &hkey, KEY_READ, &attr ))
{
set_registry_variables( env, hkey, REG_SZ );
@@ -173,7 +163,7 @@ static BOOL set_registry_environment( WCHAR **env, BOOL first_time )
NtClose( hkey );
}
- RtlInitUnicodeString( &nameW, volatile_envW );
+ RtlInitUnicodeString( &nameW, L"Volatile Environment" );
if (!NtOpenKey( &hkey, KEY_READ, &attr ))
{
set_registry_variables( env, hkey, REG_SZ );
@@ -237,26 +227,6 @@ static WCHAR *get_registry_value( WCHAR *env, HKEY hkey, const WCHAR *name )
*/
static void set_additional_environment( WCHAR **env )
{
- static const WCHAR profile_keyW[] = {'\\','R','e','g','i','s','t','r','y','\\',
- 'M','a','c','h','i','n','e','\\',
- 'S','o','f','t','w','a','r','e','\\',
- 'M','i','c','r','o','s','o','f','t','\\',
- 'W','i','n','d','o','w','s',' ','N','T','\\',
- 'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\',
- 'P','r','o','f','i','l','e','L','i','s','t',0};
- static const WCHAR computer_keyW[] = {'\\','R','e','g','i','s','t','r','y','\\',
- 'M','a','c','h','i','n','e','\\',
- 'S','y','s','t','e','m','\\',
- 'C','u','r','r','e','n','t','C','o','n','t','r','o','l','S','e','t','\\',
- 'C','o','n','t','r','o','l','\\',
- 'C','o','m','p','u','t','e','r','N','a','m','e','\\',
- 'A','c','t','i','v','e','C','o','m','p','u','t','e','r','N','a','m','e',0};
- static const WCHAR computer_valueW[] = {'C','o','m','p','u','t','e','r','N','a','m','e',0};
- static const WCHAR public_valueW[] = {'P','u','b','l','i','c',0};
- static const WCHAR computernameW[] = {'C','O','M','P','U','T','E','R','N','A','M','E',0};
- static const WCHAR allusersW[] = {'A','L','L','U','S','E','R','S','P','R','O','F','I','L','E',0};
- static const WCHAR programdataW[] = {'P','r','o','g','r','a','m','D','a','t','a',0};
- static const WCHAR publicW[] = {'P','U','B','L','I','C',0};
OBJECT_ATTRIBUTES attr;
UNICODE_STRING nameW;
WCHAR *val;
@@ -265,18 +235,19 @@ static void set_additional_environment( WCHAR **env )
/* set the user profile variables */
InitializeObjectAttributes( &attr, &nameW, 0, 0, NULL );
- RtlInitUnicodeString( &nameW, profile_keyW );
+ RtlInitUnicodeString( &nameW, L"\\Registry\\Machine\\Software\\Microsoft\\Windows NT\\"
+ "CurrentVersion\\ProfileList" );
if (!NtOpenKey( &hkey, KEY_READ, &attr ))
{
- if ((val = get_registry_value( *env, hkey, programdataW )))
+ if ((val = get_registry_value( *env, hkey, L"ProgramData" )))
{
- set_env_var( env, allusersW, val );
- set_env_var( env, programdataW, val );
+ set_env_var( env, L"ALLUSERSPROFILE", val );
+ set_env_var( env, L"ProgramData", val );
RtlFreeHeap( GetProcessHeap(), 0, val );
}
- if ((val = get_registry_value( *env, hkey, public_valueW )))
+ if ((val = get_registry_value( *env, hkey, L"Public" )))
{
- set_env_var( env, publicW, val );
+ set_env_var( env, L"PUBLIC", val );
RtlFreeHeap( GetProcessHeap(), 0, val );
}
NtClose( hkey );
@@ -284,12 +255,13 @@ static void set_additional_environment( WCHAR **env )
/* set the computer name */
- RtlInitUnicodeString( &nameW, computer_keyW );
+ RtlInitUnicodeString( &nameW, L"\\Registry\\Machine\\System\\CurrentControlSet\\Control\\"
+ "ComputerName\\ActiveComputerName" );
if (!NtOpenKey( &hkey, KEY_READ, &attr ))
{
- if ((val = get_registry_value( *env, hkey, computer_valueW )))
+ if ((val = get_registry_value( *env, hkey, L"ComputerName" )))
{
- set_env_var( env, computernameW, val );
+ set_env_var( env, L"COMPUTERNAME", val );
RtlFreeHeap( GetProcessHeap(), 0, val );
}
NtClose( hkey );
@@ -304,25 +276,8 @@ static void set_additional_environment( WCHAR **env )
*/
static void set_wow64_environment( WCHAR **env )
{
- static WCHAR archW[] = {'P','R','O','C','E','S','S','O','R','_','A','R','C','H','I','T','E','C','T','U','R','E',0};
- static WCHAR arch6432W[] = {'P','R','O','C','E','S','S','O','R','_','A','R','C','H','I','T','E','W','6','4','3','2',0};
- static const WCHAR x86W[] = {'x','8','6',0};
- static const WCHAR versionW[] = {'\\','R','e','g','i','s','t','r','y','\\',
- 'M','a','c','h','i','n','e','\\',
- 'S','o','f','t','w','a','r','e','\\',
- 'M','i','c','r','o','s','o','f','t','\\',
- 'W','i','n','d','o','w','s','\\',
- 'C','u','r','r','e','n','t','V','e','r','s','i','o','n',0};
- static const WCHAR progdirW[] = {'P','r','o','g','r','a','m','F','i','l','e','s','D','i','r',0};
- static const WCHAR progdir86W[] = {'P','r','o','g','r','a','m','F','i','l','e','s','D','i','r',' ','(','x','8','6',')',0};
- static const WCHAR progfilesW[] = {'P','r','o','g','r','a','m','F','i','l','e','s',0};
- static const WCHAR progfiles86W[] = {'P','r','o','g','r','a','m','F','i','l','e','s','(','x','8','6',')',0};
- static const WCHAR progw6432W[] = {'P','r','o','g','r','a','m','W','6','4','3','2',0};
- static const WCHAR commondirW[] = {'C','o','m','m','o','n','F','i','l','e','s','D','i','r',0};
- static const WCHAR commondir86W[] = {'C','o','m','m','o','n','F','i','l','e','s','D','i','r',' ','(','x','8','6',')',0};
- static const WCHAR commonfilesW[] = {'C','o','m','m','o','n','P','r','o','g','r','a','m','F','i','l','e','s',0};
- static const WCHAR commonfiles86W[] = {'C','o','m','m','o','n','P','r','o','g','r','a','m','F','i','l','e','s','(','x','8','6',')',0};
- static const WCHAR commonw6432W[] = {'C','o','m','m','o','n','P','r','o','g','r','a','m','W','6','4','3','2',0};
+ static WCHAR archW[] = L"PROCESSOR_ARCHITECTURE";
+ static WCHAR arch6432W[] = L"PROCESSOR_ARCHITEW6432";
WCHAR buf[256];
UNICODE_STRING arch_strW = { sizeof(archW) - sizeof(WCHAR), sizeof(archW), archW };
@@ -363,42 +318,42 @@ static void set_wow64_environment( WCHAR **env )
if (is_wow64)
{
RtlSetEnvironmentVariable( env, &arch6432_strW, &valW );
- RtlInitUnicodeString( &nameW, x86W );
+ RtlInitUnicodeString( &nameW, L"x86" );
RtlSetEnvironmentVariable( env, &arch_strW, &nameW );
}
}
InitializeObjectAttributes( &attr, &nameW, 0, 0, NULL );
- RtlInitUnicodeString( &nameW, versionW );
+ RtlInitUnicodeString( &nameW, L"\\Registry\\Machine\\Software\\Microsoft\\Windows\\CurrentVersion" );
if (NtOpenKey( &hkey, KEY_READ | KEY_WOW64_64KEY, &attr )) return;
/* set the ProgramFiles variables */
- if ((val = get_registry_value( *env, hkey, progdirW )))
+ if ((val = get_registry_value( *env, hkey, L"ProgramFilesDir" )))
{
- if (is_win64 || is_wow64) set_env_var( env, progw6432W, val );
- if (is_win64 || !is_wow64) set_env_var( env, progfilesW, val );
+ if (is_win64 || is_wow64) set_env_var( env, L"ProgramW6432", val );
+ if (is_win64 || !is_wow64) set_env_var( env, L"ProgramFiles", val );
RtlFreeHeap( GetProcessHeap(), 0, val );
}
- if ((val = get_registry_value( *env, hkey, progdir86W )))
+ if ((val = get_registry_value( *env, hkey, L"ProgramFilesDir (x86)" )))
{
- if (is_win64 || is_wow64) set_env_var( env, progfiles86W, val );
- if (is_wow64) set_env_var( env, progfilesW, val );
+ if (is_win64 || is_wow64) set_env_var( env, L"ProgramFiles(x86)", val );
+ if (is_wow64) set_env_var( env, L"ProgramFiles", val );
RtlFreeHeap( GetProcessHeap(), 0, val );
}
/* set the CommonProgramFiles variables */
- if ((val = get_registry_value( *env, hkey, commondirW )))
+ if ((val = get_registry_value( *env, hkey, L"CommonFilesDir" )))
{
- if (is_win64 || is_wow64) set_env_var( env, commonw6432W, val );
- if (is_win64 || !is_wow64) set_env_var( env, commonfilesW, val );
+ if (is_win64 || is_wow64) set_env_var( env, L"CommonProgramW6432", val );
+ if (is_win64 || !is_wow64) set_env_var( env, L"CommonProgramFiles", val );
RtlFreeHeap( GetProcessHeap(), 0, val );
}
- if ((val = get_registry_value( *env, hkey, commondir86W )))
+ if ((val = get_registry_value( *env, hkey, L"CommonFilesDir (x86)" )))
{
- if (is_win64 || is_wow64) set_env_var( env, commonfiles86W, val );
- if (is_wow64) set_env_var( env, commonfilesW, val );
+ if (is_win64 || is_wow64) set_env_var( env, L"CommonProgramFiles(x86)", val );
+ if (is_wow64) set_env_var( env, L"CommonProgramFiles", val );
RtlFreeHeap( GetProcessHeap(), 0, val );
}
NtClose( hkey );
@@ -469,7 +424,6 @@ static inline BOOL is_path_prefix( const WCHAR *prefix, const WCHAR *path, const
*/
static void get_image_path( const WCHAR *name, UNICODE_STRING *path )
{
- static const WCHAR exeW[] = {'.','e','x','e',0};
WCHAR *load_path, *file_part, full_name[MAX_PATH];
DWORD len;
@@ -482,7 +436,7 @@ static void get_image_path( const WCHAR *name, UNICODE_STRING *path )
if (RtlDoesFileExists_U( full_name )) goto done;
if (len < (MAX_PATH - 4) * sizeof(WCHAR) && !wcschr( file_part, '.' ))
{
- wcscat( file_part, exeW );
+ wcscat( file_part, L".exe" );
if (RtlDoesFileExists_U( full_name )) goto done;
}
/* check for builtin path inside system directory */
@@ -495,7 +449,7 @@ static void get_image_path( const WCHAR *name, UNICODE_STRING *path )
else
{
RtlGetExePath( name, &load_path );
- len = RtlDosSearchPath_U( load_path, name, exeW, sizeof(full_name), full_name, &file_part );
+ len = RtlDosSearchPath_U( load_path, name, L".exe", sizeof(full_name), full_name, &file_part );
RtlReleasePath( load_path );
if (!len || len > sizeof(full_name))
{
@@ -504,7 +458,7 @@ static void get_image_path( const WCHAR *name, UNICODE_STRING *path )
if (wcslen( name ) >= MAX_PATH - 4 - len) goto failed;
wcscpy( full_name, system_dir );
wcscat( full_name, name );
- if (!wcschr( name, '.' )) wcscat( full_name, exeW );
+ if (!wcschr( name, '.' )) wcscat( full_name, L".exe" );
}
}
done:
@@ -1140,15 +1094,6 @@ static inline void get_unicode_string( UNICODE_STRING *str, WCHAR **src, UINT le
*/
static void run_wineboot( WCHAR **env )
{
- static const WCHAR wineboot_eventW[] = {'\\','K','e','r','n','e','l','O','b','j','e','c','t','s',
- '\\','_','_','w','i','n','e','b','o','o','t','_','e','v','e','n','t',0};
- static const WCHAR wineboot[] = {'\\','?','?','\\','C',':','\\','w','i','n','d','o','w','s','\\',
- 's','y','s','t','e','m','3','2','\\',
- 'w','i','n','e','b','o','o','t','.','e','x','e',0};
- static const WCHAR cmdline[] = {'C',':','\\','w','i','n','d','o','w','s','\\',
- 's','y','s','t','e','m','3','2','\\',
- 'w','i','n','e','b','o','o','t','.','e','x','e',' ',
- '-','-','i','n','i','t',0};
UNICODE_STRING nameW, cmdlineW, dllpathW;
RTL_USER_PROCESS_PARAMETERS *params;
RTL_USER_PROCESS_INFORMATION info;
@@ -1160,7 +1105,7 @@ static void run_wineboot( WCHAR **env )
ULONG redir = 0;
int count = 1;
- RtlInitUnicodeString( &nameW, wineboot_eventW );
+ RtlInitUnicodeString( &nameW, L"\\KernelObjects\\__wineboot_event" );
InitializeObjectAttributes( &attr, &nameW, OBJ_OPENIF, 0, NULL );
status = NtCreateEvent( &handles[0], EVENT_ALL_ACCESS, &attr, NotificationEvent, 0 );
@@ -1170,17 +1115,18 @@ static void run_wineboot( WCHAR **env )
ERR( "failed to create wineboot event, expect trouble\n" );
return;
}
- LdrGetDllPath( wineboot + 4, LOAD_WITH_ALTERED_SEARCH_PATH, &load_path, &dummy );
- RtlInitUnicodeString( &nameW, wineboot + 4 );
+ LdrGetDllPath( L"C:\\windows\\system32\\wineboot.exe", LOAD_WITH_ALTERED_SEARCH_PATH,
+ &load_path, &dummy );
+ RtlInitUnicodeString( &nameW, L"C:\\windows\\system32\\wineboot.exe" );
RtlInitUnicodeString( &dllpathW, load_path );
- RtlInitUnicodeString( &cmdlineW, cmdline );
+ RtlInitUnicodeString( &cmdlineW, L"C:\\windows\\system32\\wineboot.exe --init" );
RtlCreateProcessParametersEx( ¶ms, &nameW, &dllpathW, NULL, &cmdlineW, *env, NULL, NULL,
NULL, NULL, PROCESS_PARAMS_FLAG_NORMALIZED );
params->hStdInput = 0;
params->hStdOutput = 0;
params->hStdError = NtCurrentTeb()->Peb->ProcessParameters->hStdError;
- RtlInitUnicodeString( &nameW, wineboot );
+ RtlInitUnicodeString( &nameW, L"\\??\\C:\\windows\\system32\\wineboot.exe" );
RtlWow64EnableFsRedirectionEx( TRUE, &redir );
status = RtlCreateUserProcess( &nameW, OBJ_CASE_INSENSITIVE, params,
NULL, NULL, 0, FALSE, 0, 0, &info );
diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c
index ff5a175027c..45ad496fd64 100644
--- a/dlls/ntdll/loader.c
+++ b/dlls/ntdll/loader.c
@@ -63,23 +63,16 @@ void (FASTCALL *pBaseThreadInitThunk)(DWORD,LPTHREAD_START_ROUTINE,void *) = NUL
const struct unix_funcs *unix_funcs = NULL;
/* windows directory */
-const WCHAR windows_dir[] = {'C',':','\\','w','i','n','d','o','w','s',0};
+const WCHAR windows_dir[] = L"C:\\windows";
/* system directory with trailing backslash */
-const WCHAR system_dir[] = {'C',':','\\','w','i','n','d','o','w','s','\\',
- 's','y','s','t','e','m','3','2','\\',0};
-const WCHAR syswow64_dir[] = {'C',':','\\','w','i','n','d','o','w','s','\\',
- 's','y','s','w','o','w','6','4','\\',0};
+const WCHAR system_dir[] = L"C:\\windows\\system32\\";
+const WCHAR syswow64_dir[] = L"C:\\windows\\syswow64\\";
static const BOOL is_win64 = (sizeof(void *) > sizeof(int));
BOOL is_wow64 = FALSE;
/* system search path */
-static const WCHAR system_path[] =
- {'C',':','\\','w','i','n','d','o','w','s','\\','s','y','s','t','e','m','3','2',';',
- 'C',':','\\','w','i','n','d','o','w','s','\\','s','y','s','t','e','m',';',
- 'C',':','\\','w','i','n','d','o','w','s',0};
-
-static const WCHAR dotW[] = {'.',0};
+static const WCHAR system_path[] = L"C:\\windows\\system32;C:\\windows\\system;C:\\windows";
static BOOL imports_fixup_done = FALSE; /* set once the imports have been fixed up, before attaching them */
static BOOL process_detaching = FALSE; /* set on process detach to avoid deadlocks with thread detach */
@@ -116,8 +109,6 @@ static const char * const reason_names[] =
"WINE_PREATTACH"
};
-static const WCHAR dllW[] = {'.','d','l','l',0};
-
struct file_id
{
BYTE ObjectId[16];
@@ -613,20 +604,21 @@ static FARPROC find_forwarded_export( HMODULE module, const char *forward, LPCWS
FARPROC proc = NULL;
if (!end) return NULL;
- if ((end - forward) * sizeof(WCHAR) > sizeof(buffer) - sizeof(dllW))
+ if ((end - forward) * sizeof(WCHAR) > sizeof(buffer) - sizeof(L".dll"))
{
- if (!(mod_name = RtlAllocateHeap( GetProcessHeap(), 0, (end - forward + sizeof(dllW)) * sizeof(WCHAR) )))
+ if (!(mod_name = RtlAllocateHeap( GetProcessHeap(), 0,
+ (end - forward + sizeof(L".dll")) * sizeof(WCHAR) )))
return NULL;
}
ascii_to_unicode( mod_name, forward, end - forward );
mod_name[end - forward] = 0;
if (!wcschr( mod_name, '.' ))
- memcpy( mod_name + (end - forward), dllW, sizeof(dllW) );
+ memcpy( mod_name + (end - forward), L".dll", sizeof(L".dll") );
if (!(wm = find_basename_module( mod_name )))
{
TRACE( "delay loading %s for '%s'\n", debugstr_w(mod_name), forward );
- if (load_dll( load_path, mod_name, dllW, 0, &wm ) == STATUS_SUCCESS &&
+ if (load_dll( load_path, mod_name, L".dll", 0, &wm ) == STATUS_SUCCESS &&
!(wm->ldr.Flags & LDR_DONT_RESOLVE_REFS))
{
if (!imports_fixup_done && current_modref)
@@ -789,7 +781,7 @@ static BOOL import_dll( HMODULE module, const IMAGE_IMPORT_DESCRIPTOR *descr, LP
{
ascii_to_unicode( buffer, name, len );
buffer[len] = 0;
- status = load_dll( load_path, buffer, dllW, 0, &wmImp );
+ status = load_dll( load_path, buffer, L".dll", 0, &wmImp );
}
else /* need to allocate a larger buffer */
{
@@ -797,7 +789,7 @@ static BOOL import_dll( HMODULE module, const IMAGE_IMPORT_DESCRIPTOR *descr, LP
if (!ptr) return FALSE;
ascii_to_unicode( ptr, name, len );
ptr[len] = 0;
- status = load_dll( load_path, ptr, dllW, 0, &wmImp );
+ status = load_dll( load_path, ptr, L".dll", 0, &wmImp );
RtlFreeHeap( GetProcessHeap(), 0, ptr );
}
@@ -930,8 +922,6 @@ static NTSTATUS create_module_activation_context( LDR_DATA_TABLE_ENTRY *module )
*/
static BOOL is_dll_native_subsystem( LDR_DATA_TABLE_ENTRY *mod, const IMAGE_NT_HEADERS *nt, LPCWSTR filename )
{
- static const WCHAR ntdllW[] = {'n','t','d','l','l','.','d','l','l',0};
- static const WCHAR kernel32W[] = {'k','e','r','n','e','l','3','2','.','d','l','l',0};
const IMAGE_IMPORT_DESCRIPTOR *imports;
DWORD i, size;
WCHAR buffer[16];
@@ -949,7 +939,7 @@ static BOOL is_dll_native_subsystem( LDR_DATA_TABLE_ENTRY *mod, const IMAGE_NT_H
DWORD len = strlen(name);
if (len * sizeof(WCHAR) >= sizeof(buffer)) continue;
ascii_to_unicode( buffer, name, len + 1 );
- if (!wcsicmp( buffer, ntdllW ) || !wcsicmp( buffer, kernel32W ))
+ if (!wcsicmp( buffer, L"ntdll.dll" ) || !wcsicmp( buffer, L"kernel32.dll" ))
{
TRACE( "%s imports %s, assuming not native\n", debugstr_w(filename), debugstr_w(buffer) );
return FALSE;
@@ -1067,7 +1057,6 @@ static void free_tls_slot( LDR_DATA_TABLE_ENTRY *mod )
*/
static NTSTATUS fixup_imports_ilonly( WINE_MODREF *wm, LPCWSTR load_path, void **entry )
{
- static const WCHAR mscoreeW[] = {'m','s','c','o','r','e','e','.','d','l','l',0};
IMAGE_EXPORT_DIRECTORY *exports;
DWORD exp_size;
NTSTATUS status;
@@ -1082,7 +1071,7 @@ static NTSTATUS fixup_imports_ilonly( WINE_MODREF *wm, LPCWSTR load_path, void *
prev = current_modref;
current_modref = wm;
- if (!(status = load_dll( load_path, mscoreeW, NULL, 0, &imp ))) wm->deps[0] = imp;
+ if (!(status = load_dll( load_path, L"mscoree.dll", NULL, 0, &imp ))) wm->deps[0] = imp;
current_modref = prev;
if (status)
{
@@ -2099,8 +2088,6 @@ static inline WCHAR *append_path( WCHAR *p, const WCHAR *str, int len )
*/
static NTSTATUS get_dll_load_path( LPCWSTR module, LPCWSTR dll_dir, ULONG safe_mode, WCHAR **path )
{
- static const WCHAR pathW[] = {'P','A','T','H',0};
-
const WCHAR *mod_end = module;
UNICODE_STRING name, value;
WCHAR *p, *ret;
@@ -2112,7 +2099,7 @@ static NTSTATUS get_dll_load_path( LPCWSTR module, LPCWSTR dll_dir, ULONG safe_m
len += (mod_end - module) + 1;
}
- RtlInitUnicodeString( &name, pathW );
+ RtlInitUnicodeString( &name, L"PATH" );
value.Length = 0;
value.MaximumLength = 0;
value.Buffer = NULL;
@@ -2126,9 +2113,9 @@ static NTSTATUS get_dll_load_path( LPCWSTR module, LPCWSTR dll_dir, ULONG safe_m
p = append_path( p, module, mod_end - module );
if (dll_dir) p = append_path( p, dll_dir, -1 );
- else if (!safe_mode) p = append_path( p, dotW, -1 );
+ else if (!safe_mode) p = append_path( p, L".", -1 );
p = append_path( p, system_path, -1 );
- if (!dll_dir && safe_mode) p = append_path( p, dotW, -1 );
+ if (!dll_dir && safe_mode) p = append_path( p, L".", -1 );
value.Buffer = p;
value.MaximumLength = path_len;
@@ -2400,7 +2387,6 @@ static NTSTATUS load_builtin_dll( LPCWSTR load_path, const UNICODE_STRING *nt_na
static NTSTATUS find_actctx_dll( LPCWSTR libname, LPWSTR *fullname )
{
static const WCHAR winsxsW[] = {'\\','w','i','n','s','x','s','\\'};
- static const WCHAR dotManifestW[] = {'.','m','a','n','i','f','e','s','t',0};
ACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION *info;
ACTCTX_SECTION_KEYED_DATA data;
@@ -2446,7 +2432,7 @@ static NTSTATUS find_actctx_dll( LPCWSTR libname, LPWSTR *fullname )
len = wcslen( p );
if (!dirlen || len <= dirlen ||
RtlCompareUnicodeStrings( p, dirlen, info->lpAssemblyDirectoryName, dirlen, TRUE ) ||
- wcsicmp( p + dirlen, dotManifestW ))
+ wcsicmp( p + dirlen, L".manifest" ))
{
/* manifest name does not match directory name, so it's not a global
* windows/winsxs manifest; use the manifest directory name instead */
@@ -2794,7 +2780,7 @@ NTSTATUS WINAPI DECLSPEC_HOTPATCH LdrLoadDll(LPCWSTR path_name, DWORD flags,
RtlEnterCriticalSection( &loader_section );
if (!path_name) path_name = NtCurrentTeb()->Peb->ProcessParameters->DllPath.Buffer;
- nts = load_dll( path_name, libname->Buffer, dllW, flags, &wm );
+ nts = load_dll( path_name, libname->Buffer, L".dll", flags, &wm );
if (nts == STATUS_SUCCESS && !(wm->ldr.Flags & LDR_DONT_RESOLVE_REFS))
{
@@ -2828,7 +2814,7 @@ NTSTATUS WINAPI LdrGetDllHandle( LPCWSTR load_path, ULONG flags, const UNICODE_S
if (!load_path) load_path = NtCurrentTeb()->Peb->ProcessParameters->DllPath.Buffer;
- status = find_dll_file( load_path, name->Buffer, dllW, &nt_name, &wm, &module, &image_info, &id );
+ status = find_dll_file( load_path, name->Buffer, L".dll", &nt_name, &wm, &module, &image_info, &id );
if (wm) *base = wm->ldr.DllBase;
else
@@ -3574,20 +3560,6 @@ void WINAPI LdrInitializeThunk( CONTEXT *context, ULONG_PTR unknown2, ULONG_PTR
*/
static void load_global_options(void)
{
- static const WCHAR sessionW[] = {'M','a','c','h','i','n','e','\\',
- 'S','y','s','t','e','m','\\',
- 'C','u','r','r','e','n','t','C','o','n','t','r','o','l','S','e','t','\\',
- 'C','o','n','t','r','o','l','\\',
- 'S','e','s','s','i','o','n',' ','M','a','n','a','g','e','r',0};
- static const WCHAR globalflagW[] = {'G','l','o','b','a','l','F','l','a','g',0};
- static const WCHAR safesearchW[] = {'S','a','f','e','P','r','o','c','e','s','s','S','e','a','r','c','h','M','o','d','e',0};
- static const WCHAR safedllmodeW[] = {'S','a','f','e','D','l','l','S','e','a','r','c','h','M','o','d','e',0};
- static const WCHAR critsectW[] = {'C','r','i','t','i','c','a','l','S','e','c','t','i','o','n','T','i','m','e','o','u','t',0};
- static const WCHAR heapresW[] = {'H','e','a','p','S','e','g','m','e','n','t','R','e','s','e','r','v','e',0};
- static const WCHAR heapcommitW[] = {'H','e','a','p','S','e','g','m','e','n','t','C','o','m','m','i','t',0};
- static const WCHAR decommittotalW[] = {'H','e','a','p','D','e','C','o','m','m','i','t','T','o','t','a','l','F','r','e','e','T','h','r','e','s','h','o','l','d',0};
- static const WCHAR decommitfreeW[] = {'H','e','a','p','D','e','C','o','m','m','i','t','F','r','e','e','B','l','o','c','k','T','h','r','e','s','h','o','l','d',0};
-
OBJECT_ATTRIBUTES attr;
UNICODE_STRING name_str;
HANDLE hkey;
@@ -3599,33 +3571,33 @@ static void load_global_options(void)
attr.Attributes = OBJ_CASE_INSENSITIVE;
attr.SecurityDescriptor = NULL;
attr.SecurityQualityOfService = NULL;
- RtlInitUnicodeString( &name_str, sessionW );
+ RtlInitUnicodeString( &name_str, L"Machine\\System\\CurrentControlSet\\Control\\Session Manager" );
if (!NtOpenKey( &hkey, KEY_QUERY_VALUE, &attr ))
{
- query_dword_option( hkey, globalflagW, &NtCurrentTeb()->Peb->NtGlobalFlag );
- query_dword_option( hkey, safesearchW, &path_safe_mode );
- query_dword_option( hkey, safedllmodeW, &dll_safe_mode );
+ query_dword_option( hkey, L"GlobalFlag", &NtCurrentTeb()->Peb->NtGlobalFlag );
+ query_dword_option( hkey, L"SafeProcessSearchMode", &path_safe_mode );
+ query_dword_option( hkey, L"SafeDllSearchMode", &dll_safe_mode );
- if (!query_dword_option( hkey, critsectW, &value ))
+ if (!query_dword_option( hkey, L"CriticalSectionTimeout", &value ))
NtCurrentTeb()->Peb->CriticalSectionTimeout.QuadPart = (ULONGLONG)value * -10000000;
- if (!query_dword_option( hkey, heapresW, &value ))
+ if (!query_dword_option( hkey, L"HeapSegmentReserve", &value ))
NtCurrentTeb()->Peb->HeapSegmentReserve = value;
- if (!query_dword_option( hkey, heapcommitW, &value ))
+ if (!query_dword_option( hkey, L"HeapSegmentCommit", &value ))
NtCurrentTeb()->Peb->HeapSegmentCommit = value;
- if (!query_dword_option( hkey, decommittotalW, &value ))
+ if (!query_dword_option( hkey, L"HeapDeCommitTotalFreeThreshold", &value ))
NtCurrentTeb()->Peb->HeapDeCommitTotalFreeThreshold = value;
- if (!query_dword_option( hkey, decommitfreeW, &value ))
+ if (!query_dword_option( hkey, L"HeapDeCommitFreeBlockThreshold", &value ))
NtCurrentTeb()->Peb->HeapDeCommitFreeBlockThreshold = value;
NtClose( hkey );
}
LdrQueryImageFileExecutionOptions( &NtCurrentTeb()->Peb->ProcessParameters->ImagePathName,
- globalflagW, REG_DWORD, &NtCurrentTeb()->Peb->NtGlobalFlag,
+ L"GlobalFlag", REG_DWORD, &NtCurrentTeb()->Peb->NtGlobalFlag,
sizeof(DWORD), NULL );
heap_set_debug_flags( GetProcessHeap() );
}
@@ -3918,21 +3890,17 @@ NTSTATUS WINAPI RtlSetSearchPathMode( ULONG flags )
*/
NTSTATUS WINAPI RtlGetExePath( PCWSTR name, PWSTR *path )
{
- static const WCHAR emptyW[1];
- const WCHAR *dlldir = dotW;
+ const WCHAR *dlldir = L".";
const WCHAR *module = NtCurrentTeb()->Peb->ProcessParameters->ImagePathName.Buffer;
/* same check as NeedCurrentDirectoryForExePathW */
if (!wcschr( name, '\\' ))
{
- static const WCHAR env_name[] = {'N','o','D','e','f','a','u','l','t','C','u','r','r','e','n','t',
- 'D','i','r','e','c','t','o','r','y','I','n',
- 'E','x','e','P','a','t','h',0};
UNICODE_STRING name, value = { 0 };
- RtlInitUnicodeString( &name, env_name );
+ RtlInitUnicodeString( &name, L"NoDefaultCurrentDirectoryInExePath" );
if (RtlQueryEnvironmentVariable_U( NULL, &name, &value ) != STATUS_VARIABLE_NOT_FOUND)
- dlldir = emptyW;
+ dlldir = L"";
}
return get_dll_load_path( module, dlldir, FALSE, path );
}
@@ -3995,12 +3963,6 @@ static void restart_winevdm( RTL_USER_PROCESS_PARAMETERS *params )
*/
static NTSTATUS process_init(void)
{
- static const WCHAR ntdllW[] = {'\\','?','?','\\','C',':','\\','w','i','n','d','o','w','s','\\',
- 's','y','s','t','e','m','3','2','\\',
- 'n','t','d','l','l','.','d','l','l',0};
- static const WCHAR kernel32W[] = {'C',':','\\','w','i','n','d','o','w','s','\\',
- 's','y','s','t','e','m','3','2','\\',
- 'k','e','r','n','e','l','3','2','.','d','l','l',0};
RTL_USER_PROCESS_PARAMETERS *params;
WINE_MODREF *wm;
NTSTATUS status;
@@ -4046,13 +4008,14 @@ static NTSTATUS process_init(void)
version_init();
/* setup the load callback and create ntdll modref */
- RtlInitUnicodeString( &nt_name, ntdllW );
+ RtlInitUnicodeString( &nt_name, L"\\??\\C:\\windows\\system32\\ntdll.dll" );
NtQueryVirtualMemory( GetCurrentProcess(), process_init, MemoryBasicInformation,
&meminfo, sizeof(meminfo), NULL );
status = build_builtin_module( params->DllPath.Buffer, &nt_name, meminfo.AllocationBase, 0, &wm );
assert( !status );
- if ((status = load_dll( params->DllPath.Buffer, kernel32W, NULL, 0, &wm )) != STATUS_SUCCESS)
+ if ((status = load_dll( params->DllPath.Buffer, L"C:\\windows\\system32\\kernel32.dll",
+ NULL, 0, &wm )) != STATUS_SUCCESS)
{
MESSAGE( "wine: could not load kernel32.dll, status %x\n", status );
NtTerminateProcess( GetCurrentProcess(), status );
diff --git a/dlls/ntdll/loadorder.c b/dlls/ntdll/loadorder.c
index c55806df2b8..e4aaf9dd74f 100644
--- a/dlls/ntdll/loadorder.c
+++ b/dlls/ntdll/loadorder.c
@@ -49,7 +49,7 @@ struct loadorder_list
module_loadorder_t *order;
};
-static const WCHAR separatorsW[] = {',',' ','\t',0};
+static const WCHAR separatorsW[] = L", \t";
static BOOL init_done;
static struct loadorder_list env_list;
@@ -89,10 +89,9 @@ static const WCHAR *get_basename( const WCHAR *name )
*/
static inline void remove_dll_ext( WCHAR *name )
{
- static const WCHAR dllW[] = {'.','d','l','l',0};
WCHAR *p = wcsrchr( name, '.' );
- if (p && !wcsicmp( p, dllW )) *p = 0;
+ if (p && !wcsicmp( p, L".dll" )) *p = 0;
}
@@ -224,7 +223,6 @@ static void add_load_order_set( WCHAR *entry )
*/
static void init_load_order(void)
{
- static const WCHAR winedlloverridesW[] = {'W','I','N','E','D','L','L','O','V','E','R','R','I','D','E','S',0};
WCHAR *entry, *next, *order;
SIZE_T len = 1024;
NTSTATUS status;
@@ -234,7 +232,7 @@ static void init_load_order(void)
for (;;)
{
order = RtlAllocateHeap( GetProcessHeap(), 0, len * sizeof(WCHAR) );
- status = RtlQueryEnvironmentVariable( NULL, winedlloverridesW, wcslen(winedlloverridesW),
+ status = RtlQueryEnvironmentVariable( NULL, L"WINEDLLOVERRIDES", wcslen(L"WINEDLLOVERRIDES"),
order, len - 1, &len );
if (!status)
{
@@ -290,8 +288,6 @@ static inline enum loadorder get_env_load_order( const WCHAR *module )
*/
static HANDLE get_standard_key(void)
{
- static const WCHAR DllOverridesW[] = {'S','o','f','t','w','a','r','e','\\','W','i','n','e','\\',
- 'D','l','l','O','v','e','r','r','i','d','e','s',0};
static HANDLE std_key = (HANDLE)-1;
if (std_key == (HANDLE)-1)
@@ -307,7 +303,7 @@ static HANDLE get_standard_key(void)
attr.Attributes = 0;
attr.SecurityDescriptor = NULL;
attr.SecurityQualityOfService = NULL;
- RtlInitUnicodeString( &nameW, DllOverridesW );
+ RtlInitUnicodeString( &nameW, L"Software\\Wine\\DllOverrides" );
/* @@ Wine registry key: HKCU\Software\Wine\DllOverrides */
if (NtOpenKey( &std_key, KEY_ALL_ACCESS, &attr )) std_key = 0;
@@ -328,20 +324,17 @@ static HANDLE get_app_key( const WCHAR *app_name )
UNICODE_STRING nameW;
HANDLE root;
WCHAR *str;
- static const WCHAR AppDefaultsW[] = {'S','o','f','t','w','a','r','e','\\','W','i','n','e','\\',
- 'A','p','p','D','e','f','a','u','l','t','s','\\',0};
- static const WCHAR DllOverridesW[] = {'\\','D','l','l','O','v','e','r','r','i','d','e','s',0};
static HANDLE app_key = (HANDLE)-1;
if (app_key != (HANDLE)-1) return app_key;
str = RtlAllocateHeap( GetProcessHeap(), 0,
- sizeof(AppDefaultsW) + sizeof(DllOverridesW) +
+ sizeof(L"Software\\Wine\\AppDefaults\\") + sizeof(L"\\DllOverrides") +
wcslen(app_name) * sizeof(WCHAR) );
if (!str) return 0;
- wcscpy( str, AppDefaultsW );
+ wcscpy( str, L"Software\\Wine\\AppDefaults\\" );
wcscat( str, app_name );
- wcscat( str, DllOverridesW );
+ wcscat( str, L"\\DllOverrides" );
RtlOpenCurrentUser( KEY_ALL_ACCESS, &root );
attr.Length = sizeof(attr);
@@ -425,7 +418,6 @@ static enum loadorder get_load_order_value( HANDLE std_key, HANDLE app_key, cons
*/
enum loadorder get_load_order( const WCHAR *app_name, const UNICODE_STRING *nt_name )
{
- static const WCHAR nt_prefixW[] = {'\\','?','?','\\',0};
enum loadorder ret = LO_INVALID;
HANDLE std_key, app_key = 0;
const WCHAR *path = nt_name->Buffer;
@@ -435,7 +427,7 @@ enum loadorder get_load_order( const WCHAR *app_name, const UNICODE_STRING *nt_n
if (!init_done) init_load_order();
std_key = get_standard_key();
if (app_name) app_key = get_app_key( app_name );
- if (!wcsncmp( path, nt_prefixW, 4 )) path += 4;
+ if (!wcsncmp( path, L"\\??\\", 4 )) path += 4;
TRACE("looking for %s\n", debugstr_w(path));
diff --git a/dlls/ntdll/locale.c b/dlls/ntdll/locale.c
index e3cc0d183c4..3979f41089b 100644
--- a/dlls/ntdll/locale.c
+++ b/dlls/ntdll/locale.c
@@ -1269,8 +1269,6 @@ NTSTATUS WINAPI RtlLocaleNameToLcid( const WCHAR *name, LCID *lcid, ULONG flags
{
/* locale name format is: lang[-script][-country][_modifier] */
- static const WCHAR sepW[] = {'-','_',0};
-
const IMAGE_RESOURCE_DIRECTORY *resdir;
const IMAGE_RESOURCE_DIRECTORY_ENTRY *et;
LDR_RESOURCE_INFO info;
@@ -1291,16 +1289,16 @@ NTSTATUS WINAPI RtlLocaleNameToLcid( const WCHAR *name, LCID *lcid, ULONG flags
if (wcslen( name ) >= LOCALE_NAME_MAX_LENGTH) return STATUS_INVALID_PARAMETER_1;
wcscpy( lang, name );
- if ((p = wcspbrk( lang, sepW )) && *p == '-')
+ if ((p = wcspbrk( lang, L"-_" )) && *p == '-')
{
*p++ = 0;
country = p;
- if ((p = wcspbrk( p, sepW )) && *p == '-')
+ if ((p = wcspbrk( p, L"-_" )) && *p == '-')
{
*p++ = 0;
script = country;
country = p;
- p = wcspbrk( p, sepW );
+ p = wcspbrk( p, L"-_" );
}
if (p) *p = 0; /* FIXME: modifier is ignored */
/* second value can be script or country, check length to resolve the ambiguity */
diff --git a/dlls/ntdll/path.c b/dlls/ntdll/path.c
index 53470b4f357..86760f178e1 100644
--- a/dlls/ntdll/path.c
+++ b/dlls/ntdll/path.c
@@ -31,10 +31,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(file);
-static const WCHAR DeviceRootW[] = {'\\','\\','.','\\',0};
-static const WCHAR NTDosPrefixW[] = {'\\','?','?','\\',0};
-static const WCHAR UncPfxW[] = {'U','N','C','\\',0};
-
#define IS_SEPARATOR(ch) ((ch) == '\\' || (ch) == '/')
/***********************************************************************
@@ -69,7 +65,6 @@ DOS_PATHNAME_TYPE WINAPI RtlDetermineDosPathNameType_U( PCWSTR path )
*/
ULONG WINAPI RtlIsDosDeviceName_U( PCWSTR dos_name )
{
- static const WCHAR consoleW[] = {'\\','\\','.','\\','C','O','N',0};
static const WCHAR auxW[] = {'A','U','X'};
static const WCHAR comW[] = {'C','O','M'};
static const WCHAR conW[] = {'C','O','N'};
@@ -87,7 +82,7 @@ ULONG WINAPI RtlIsDosDeviceName_U( PCWSTR dos_name )
case UNC_PATH:
return 0;
case DEVICE_PATH:
- if (!wcsicmp( dos_name, consoleW ))
+ if (!wcsicmp( dos_name, L"\\\\.\\CON" ))
return MAKELONG( sizeof(conW), 4 * sizeof(WCHAR) ); /* 4 is length of \\.\ prefix */
return 0;
case ABSOLUTE_DRIVE_PATH:
@@ -207,12 +202,12 @@ NTSTATUS WINAPI RtlDosPathNameToNtPathName_U_WithStatus(const WCHAR *dos_path, U
return STATUS_NO_MEMORY;
}
- wcscpy(ntpath->Buffer, NTDosPrefixW);
+ wcscpy(ntpath->Buffer, L"\\??\\");
switch (RtlDetermineDosPathNameType_U(ptr))
{
case UNC_PATH: /* \\foo */
offset = 2;
- wcscat(ntpath->Buffer, UncPfxW);
+ wcscat(ntpath->Buffer, L"UNC\\");
break;
case DEVICE_PATH: /* \\.\foo */
offset = 4;
@@ -661,7 +656,7 @@ DWORD WINAPI RtlGetFullPathName_U(const WCHAR* name, ULONG size, WCHAR* buffer,
DWORD sz = LOWORD(dosdev); /* in bytes */
if (8 + sz + 2 > size) return sz + 10;
- wcscpy(buffer, DeviceRootW);
+ wcscpy(buffer, L"\\\\.\\");
memmove(buffer + 4, name + offset, sz);
buffer[4 + sz / sizeof(WCHAR)] = '\0';
/* file_part isn't set in this case */
@@ -874,7 +869,7 @@ NTSTATUS WINAPI RtlSetCurrentDirectory_U(const UNICODE_STRING* dir)
if (size && ptr[size - 1] != '\\') ptr[size++] = '\\';
/* convert \??\UNC\ path to \\ prefix */
- if (size >= 4 && !wcsnicmp(ptr, UncPfxW, 4))
+ if (size >= 4 && !wcsnicmp(ptr, L"UNC\\", 4))
{
ptr += 2;
size -= 2;
diff --git a/dlls/ntdll/reg.c b/dlls/ntdll/reg.c
index 5a54d7fee26..54f01049abf 100644
--- a/dlls/ntdll/reg.c
+++ b/dlls/ntdll/reg.c
@@ -402,49 +402,30 @@ static NTSTATUS RTL_KeyHandleCreateObject(ULONG RelativeTo, PCWSTR Path, POBJECT
PCWSTR base;
INT len;
- static const WCHAR empty[] = {0};
- static const WCHAR control[] = {'\\','R','e','g','i','s','t','r','y','\\','M','a','c','h','i','n','e',
- '\\','S','y','s','t','e','m','\\','C','u','r','r','e','n','t','C','o','n','t','r','o','l','S','e','t','\\',
- 'C','o','n','t','r','o','l','\\',0};
-
- static const WCHAR devicemap[] = {'\\','R','e','g','i','s','t','r','y','\\','M','a','c','h','i','n','e','\\',
- 'H','a','r','d','w','a','r','e','\\','D','e','v','i','c','e','M','a','p','\\',0};
-
- static const WCHAR services[] = {'\\','R','e','g','i','s','t','r','y','\\','M','a','c','h','i','n','e','\\',
- 'S','y','s','t','e','m','\\','C','u','r','r','e','n','t','C','o','n','t','r','o','l','S','e','t','\\',
- 'S','e','r','v','i','c','e','s','\\',0};
-
- static const WCHAR user[] = {'\\','R','e','g','i','s','t','r','y','\\','U','s','e','r','\\',
- 'C','u','r','r','e','n','t','U','s','e','r','\\',0};
-
- static const WCHAR windows_nt[] = {'\\','R','e','g','i','s','t','r','y','\\','M','a','c','h','i','n','e','\\',
- 'S','o','f','t','w','a','r','e','\\','M','i','c','r','o','s','o','f','t','\\',
- 'W','i','n','d','o','w','s',' ','N','T','\\','C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\',0};
-
switch (RelativeTo & 0xff)
{
case RTL_REGISTRY_ABSOLUTE:
- base = empty;
+ base = L"";
break;
case RTL_REGISTRY_CONTROL:
- base = control;
+ base = L"\\Registry\\Machine\\System\\CurrentControlSet\\Control\\";
break;
case RTL_REGISTRY_DEVICEMAP:
- base = devicemap;
+ base = L"\\Registry\\Machine\\Hardware\\DeviceMap\\";
break;
case RTL_REGISTRY_SERVICES:
- base = services;
+ base = L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\";
break;
case RTL_REGISTRY_USER:
- base = user;
+ base = L"\\Registry\\User\\CurrentUser\\";
break;
case RTL_REGISTRY_WINDOWS_NT:
- base = windows_nt;
+ base = L"\\Registry\\Machine\\Software\\Microsoft\\Windows NT\\CurrentVersion\\";
break;
default:
diff --git a/dlls/ntdll/relay.c b/dlls/ntdll/relay.c
index e1596312491..ee7d9951c59 100644
--- a/dlls/ntdll/relay.c
+++ b/dlls/ntdll/relay.c
@@ -167,17 +167,6 @@ static DWORD WINAPI init_debug_lists( RTL_RUN_ONCE *once, void *param, void **co
OBJECT_ATTRIBUTES attr;
UNICODE_STRING name;
HANDLE root, hkey;
- static const WCHAR configW[] = {'S','o','f','t','w','a','r','e','\\',
- 'W','i','n','e','\\',
- 'D','e','b','u','g',0};
- static const WCHAR RelayIncludeW[] = {'R','e','l','a','y','I','n','c','l','u','d','e',0};
- static const WCHAR RelayExcludeW[] = {'R','e','l','a','y','E','x','c','l','u','d','e',0};
- static const WCHAR SnoopIncludeW[] = {'S','n','o','o','p','I','n','c','l','u','d','e',0};
- static const WCHAR SnoopExcludeW[] = {'S','n','o','o','p','E','x','c','l','u','d','e',0};
- static const WCHAR RelayFromIncludeW[] = {'R','e','l','a','y','F','r','o','m','I','n','c','l','u','d','e',0};
- static const WCHAR RelayFromExcludeW[] = {'R','e','l','a','y','F','r','o','m','E','x','c','l','u','d','e',0};
- static const WCHAR SnoopFromIncludeW[] = {'S','n','o','o','p','F','r','o','m','I','n','c','l','u','d','e',0};
- static const WCHAR SnoopFromExcludeW[] = {'S','n','o','o','p','F','r','o','m','E','x','c','l','u','d','e',0};
RtlOpenCurrentUser( KEY_ALL_ACCESS, &root );
attr.Length = sizeof(attr);
@@ -186,21 +175,21 @@ static DWORD WINAPI init_debug_lists( RTL_RUN_ONCE *once, void *param, void **co
attr.Attributes = 0;
attr.SecurityDescriptor = NULL;
attr.SecurityQualityOfService = NULL;
- RtlInitUnicodeString( &name, configW );
+ RtlInitUnicodeString( &name, L"Software\\Wine\\Debug" );
/* @@ Wine registry key: HKCU\Software\Wine\Debug */
if (NtOpenKey( &hkey, KEY_ALL_ACCESS, &attr )) hkey = 0;
NtClose( root );
if (!hkey) return TRUE;
- debug_relay_includelist = load_list( hkey, RelayIncludeW );
- debug_relay_excludelist = load_list( hkey, RelayExcludeW );
- debug_snoop_includelist = load_list( hkey, SnoopIncludeW );
- debug_snoop_excludelist = load_list( hkey, SnoopExcludeW );
- debug_from_relay_includelist = load_list( hkey, RelayFromIncludeW );
- debug_from_relay_excludelist = load_list( hkey, RelayFromExcludeW );
- debug_from_snoop_includelist = load_list( hkey, SnoopFromIncludeW );
- debug_from_snoop_excludelist = load_list( hkey, SnoopFromExcludeW );
+ debug_relay_includelist = load_list( hkey, L"RelayInclude" );
+ debug_relay_excludelist = load_list( hkey, L"RelayExclude" );
+ debug_snoop_includelist = load_list( hkey, L"SnoopInclude" );
+ debug_snoop_excludelist = load_list( hkey, L"SnoopExclude" );
+ debug_from_relay_includelist = load_list( hkey, L"RelayFromInclude" );
+ debug_from_relay_excludelist = load_list( hkey, L"RelayFromExclude" );
+ debug_from_snoop_includelist = load_list( hkey, L"SnoopFromInclude" );
+ debug_from_snoop_excludelist = load_list( hkey, L"SnoopFromExclude" );
NtClose( hkey );
return TRUE;
@@ -259,7 +248,6 @@ static BOOL check_relay_include( const WCHAR *module, int ordinal, const char *f
*/
static BOOL check_from_module( const WCHAR **includelist, const WCHAR **excludelist, const WCHAR *module )
{
- static const WCHAR dllW[] = {'.','d','l','l',0 };
const WCHAR **listitem;
BOOL show;
@@ -281,7 +269,7 @@ static BOOL check_from_module( const WCHAR **includelist, const WCHAR **excludel
if (!wcsicmp( *listitem, module )) return !show;
len = wcslen( *listitem );
- if (!wcsnicmp( *listitem, module, len ) && !wcsicmp( module + len, dllW ))
+ if (!wcsnicmp( *listitem, module, len ) && !wcsicmp( module + len, L".dll" ))
return !show;
}
return show;
diff --git a/dlls/ntdll/rtl.c b/dlls/ntdll/rtl.c
index 11dbc63a3b3..cf21c980a45 100644
--- a/dlls/ntdll/rtl.c
+++ b/dlls/ntdll/rtl.c
@@ -1314,8 +1314,6 @@ NTSTATUS WINAPI RtlIpv6StringToAddressA(const char *str, const char **terminator
NTSTATUS WINAPI RtlIpv4AddressToStringExW(const IN_ADDR *pin, USHORT port, LPWSTR buffer, PULONG psize)
{
WCHAR tmp_ip[32];
- static const WCHAR fmt_ip[] = {'%','u','.','%','u','.','%','u','.','%','u',0};
- static const WCHAR fmt_port[] = {':','%','u',0};
ULONG needed;
if (!pin || !buffer || !psize)
@@ -1323,11 +1321,11 @@ NTSTATUS WINAPI RtlIpv4AddressToStringExW(const IN_ADDR *pin, USHORT port, LPWST
TRACE("(%p:0x%x, %d, %p, %p:%d)\n", pin, pin->S_un.S_addr, port, buffer, psize, *psize);
- needed = swprintf(tmp_ip, ARRAY_SIZE(tmp_ip), fmt_ip,
+ needed = swprintf(tmp_ip, ARRAY_SIZE(tmp_ip), L"%u.%u.%u.%u",
pin->S_un.S_un_b.s_b1, pin->S_un.S_un_b.s_b2,
pin->S_un.S_un_b.s_b3, pin->S_un.S_un_b.s_b4);
- if (port) needed += swprintf(tmp_ip + needed, ARRAY_SIZE(tmp_ip) - needed, fmt_port, ntohs(port));
+ if (port) needed += swprintf(tmp_ip + needed, ARRAY_SIZE(tmp_ip) - needed, L":%u", ntohs(port));
if (*psize > needed) {
*psize = needed + 1;
diff --git a/dlls/ntdll/rtlstr.c b/dlls/ntdll/rtlstr.c
index d8ff81b8050..90f32ceecf0 100644
--- a/dlls/ntdll/rtlstr.c
+++ b/dlls/ntdll/rtlstr.c
@@ -1160,8 +1160,6 @@ NTSTATUS WINAPI RtlFindCharInUnicodeString(
*/
BOOLEAN WINAPI RtlIsTextUnicode( LPCVOID buf, INT len, INT *pf )
{
- static const WCHAR std_control_chars[] = {'\r','\n','\t',' ',0x3000,0};
- static const WCHAR byterev_control_chars[] = {0x0d00,0x0a00,0x0900,0x2000,0};
const WCHAR *s = buf;
int i;
unsigned int flags = ~0U, out_flags = 0;
@@ -1225,7 +1223,7 @@ BOOLEAN WINAPI RtlIsTextUnicode( LPCVOID buf, INT len, INT *pf )
{
for (i = 0; i < len; i++)
{
- if (wcschr(std_control_chars, s[i]))
+ if (wcschr(L"\r\n\t \x3000", s[i]))
{
out_flags |= IS_TEXT_UNICODE_CONTROLS;
break;
@@ -1237,7 +1235,7 @@ BOOLEAN WINAPI RtlIsTextUnicode( LPCVOID buf, INT len, INT *pf )
{
for (i = 0; i < len; i++)
{
- if (wcschr(byterev_control_chars, s[i]))
+ if (wcschr(L"\x0d00\x0a00\x0900\x2000", s[i]))
{
out_flags |= IS_TEXT_UNICODE_REVERSE_CONTROLS;
break;
@@ -1684,11 +1682,6 @@ NTSTATUS WINAPI RtlGUIDFromString(PUNICODE_STRING str, GUID* guid)
*/
NTSTATUS WINAPI RtlStringFromGUID(const GUID* guid, UNICODE_STRING *str)
{
- static const WCHAR szFormat[] = { '{','%','0','8','l','X','-',
- '%','0','4','X','-', '%','0','4','X','-','%','0','2','X','%','0','2','X',
- '-', '%','0','2','X','%','0','2','X','%','0','2','X','%','0','2','X',
- '%','0','2','X','%','0','2','X','}','\0' };
-
TRACE("(%p,%p)\n", guid, str);
str->Length = GUID_STRING_LENGTH * sizeof(WCHAR);
@@ -1699,7 +1692,8 @@ NTSTATUS WINAPI RtlStringFromGUID(const GUID* guid, UNICODE_STRING *str)
str->Length = str->MaximumLength = 0;
return STATUS_NO_MEMORY;
}
- swprintf(str->Buffer, str->MaximumLength/sizeof(WCHAR), szFormat, guid->Data1, guid->Data2, guid->Data3,
+ swprintf(str->Buffer, str->MaximumLength/sizeof(WCHAR),
+ L"{%08lX-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}", guid->Data1, guid->Data2, guid->Data3,
guid->Data4[0], guid->Data4[1], guid->Data4[2], guid->Data4[3],
guid->Data4[4], guid->Data4[5], guid->Data4[6], guid->Data4[7]);
@@ -1739,7 +1733,6 @@ static UINT64 get_arg( int nr, struct format_message_args *args_data, BOOL is64
static NTSTATUS add_format( WCHAR **buffer, WCHAR *end, const WCHAR **src, int insert, BOOLEAN ansi,
struct format_message_args *args_data )
{
- static const WCHAR modifiers[] = {'0','1','2','3','4','5','6','7','8','9',' ','+','-','*','#','.',0};
const WCHAR *format = *src;
WCHAR *p, fmt[32];
ULONG_PTR args[5] = { 0 };
@@ -1757,7 +1750,7 @@ static NTSTATUS add_format( WCHAR **buffer, WCHAR *end, const WCHAR **src, int i
if (!end || end - format > ARRAY_SIZE(fmt) - 2) return STATUS_INVALID_PARAMETER;
*src = end + 1;
- while (wcschr( modifiers, *format ))
+ while (wcschr( L"0123456789 +-*#.", *format ))
{
if (*format == '*') stars++;
*p++ = *format++;
@@ -1829,7 +1822,6 @@ NTSTATUS WINAPI RtlFormatMessageEx( const WCHAR *src, ULONG width, BOOLEAN ignor
BOOLEAN ansi, BOOLEAN is_array, __ms_va_list *args,
WCHAR *buffer, ULONG size, ULONG *retsize, ULONG flags )
{
- static const WCHAR emptyW = 0;
static const WCHAR spaceW = ' ';
static const WCHAR crW = '\r';
static const WCHAR tabW = '\t';
@@ -1945,7 +1937,7 @@ NTSTATUS WINAPI RtlFormatMessageEx( const WCHAR *src, ULONG width, BOOLEAN ignor
}
}
- if ((status = add_chars( &buffer, end, &emptyW, 1 ))) return status;
+ if ((status = add_chars( &buffer, end, L"", 1 ))) return status;
*retsize = (buffer - start) * sizeof(WCHAR);
return STATUS_SUCCESS;
diff --git a/dlls/ntdll/sec.c b/dlls/ntdll/sec.c
index c0f962f0562..0d45bbf02aa 100644
--- a/dlls/ntdll/sec.c
+++ b/dlls/ntdll/sec.c
@@ -1617,21 +1617,20 @@ NTSTATUS WINAPI RtlConvertSidToUnicodeString(
PSID pSid,
BOOLEAN AllocateString)
{
- static const WCHAR formatW[] = {'-','%','u',0};
WCHAR buffer[2 + 10 + 10 + 10 * SID_MAX_SUB_AUTHORITIES];
WCHAR *p = buffer;
const SID *sid = pSid;
DWORD i, len;
*p++ = 'S';
- p += swprintf( p, ARRAY_SIZE(buffer) - (p - buffer), formatW, sid->Revision );
- p += swprintf( p, ARRAY_SIZE(buffer) - (p - buffer), formatW,
+ p += swprintf( p, ARRAY_SIZE(buffer) - (p - buffer), L"-%u", sid->Revision );
+ p += swprintf( p, ARRAY_SIZE(buffer) - (p - buffer), L"-%u",
MAKELONG( MAKEWORD( sid->IdentifierAuthority.Value[5],
sid->IdentifierAuthority.Value[4] ),
MAKEWORD( sid->IdentifierAuthority.Value[3],
sid->IdentifierAuthority.Value[2] )));
for (i = 0; i < sid->SubAuthorityCount; i++)
- p += swprintf( p, ARRAY_SIZE(buffer) - (p - buffer), formatW, sid->SubAuthority[i] );
+ p += swprintf( p, ARRAY_SIZE(buffer) - (p - buffer), L"-%u", sid->SubAuthority[i] );
len = (p + 1 - buffer) * sizeof(WCHAR);
--
2.26.2
1
0
03 Dec '20
Signed-off-by: Michael Stefaniuc <mstefani(a)winehq.org>
---
dlls/ntdll/version.c | 177 ++++++++++++++++---------------------------
1 file changed, 64 insertions(+), 113 deletions(-)
diff --git a/dlls/ntdll/version.c b/dlls/ntdll/version.c
index 46715575225..740d8403f5e 100644
--- a/dlls/ntdll/version.c
+++ b/dlls/ntdll/version.c
@@ -66,20 +66,17 @@ static const RTL_OSVERSIONINFOEXW VersionData[NB_WINDOWS_VERSIONS] =
/* WIN20 FIXME: verify values */
{
sizeof(RTL_OSVERSIONINFOEXW), 2, 0, 0, VER_PLATFORM_WIN32s,
- {'W','i','n','3','2','s',' ','1','.','3',0},
- 0, 0, 0, 0, 0
+ L"Win32s 1.3", 0, 0, 0, 0, 0
},
/* WIN30 FIXME: verify values */
{
sizeof(RTL_OSVERSIONINFOEXW), 3, 0, 0, VER_PLATFORM_WIN32s,
- {'W','i','n','3','2','s',' ','1','.','3',0},
- 0, 0, 0, 0, 0
+ L"Win32s 1.3", 0, 0, 0, 0, 0
},
/* WIN31 */
{
sizeof(RTL_OSVERSIONINFOEXW), 3, 10, 0, VER_PLATFORM_WIN32s,
- {'W','i','n','3','2','s',' ','1','.','3',0},
- 0, 0, 0, 0, 0
+ L"Win32s 1.3", 0, 0, 0, 0, 0
},
/* WIN95 */
{
@@ -91,8 +88,7 @@ static const RTL_OSVERSIONINFOEXW VersionData[NB_WINDOWS_VERSIONS] =
* Win95a/b can be discerned via regkey SubVersionNumber
*/
sizeof(RTL_OSVERSIONINFOEXW), 4, 0, 0x40003B6, VER_PLATFORM_WIN32_WINDOWS,
- {0},
- 0, 0, 0, 0, 0
+ L"", 0, 0, 0, 0, 0
},
/* WIN98 (second edition) */
{
@@ -100,121 +96,111 @@ static const RTL_OSVERSIONINFOEXW VersionData[NB_WINDOWS_VERSIONS] =
* Win98SE: 4, 10, 0x40A08AE, " A " 4.10.2222
*/
sizeof(RTL_OSVERSIONINFOEXW), 4, 10, 0x40A08AE, VER_PLATFORM_WIN32_WINDOWS,
- {' ','A',' ',0},
- 0, 0, 0, 0, 0
+ L" A ", 0, 0, 0, 0, 0
},
/* WINME */
{
sizeof(RTL_OSVERSIONINFOEXW), 4, 90, 0x45A0BB8, VER_PLATFORM_WIN32_WINDOWS,
- {' ',0},
- 0, 0, 0, 0, 0
+ L" ", 0, 0, 0, 0, 0
},
/* NT351 */
{
sizeof(RTL_OSVERSIONINFOEXW), 3, 51, 0x421, VER_PLATFORM_WIN32_NT,
- {'S','e','r','v','i','c','e',' ','P','a','c','k',' ','5',0},
- 5, 0, 0, VER_NT_WORKSTATION, 0
+ L"Service Pack 5", 5, 0, 0, VER_NT_WORKSTATION, 0
},
/* NT40 */
{
sizeof(RTL_OSVERSIONINFOEXW), 4, 0, 0x565, VER_PLATFORM_WIN32_NT,
- {'S','e','r','v','i','c','e',' ','P','a','c','k',' ','6','a',0},
- 6, 0, 0, VER_NT_WORKSTATION, 0
+ L"Service Pack 6a", 6, 0, 0, VER_NT_WORKSTATION, 0
},
/* NT2K */
{
sizeof(RTL_OSVERSIONINFOEXW), 5, 0, 0x893, VER_PLATFORM_WIN32_NT,
- {'S','e','r','v','i','c','e',' ','P','a','c','k',' ','4',0},
- 4, 0, 0, VER_NT_WORKSTATION, 30 /* FIXME: Great, a reserved field with a value! */
+ L"Service Pack 4", 4, 0, 0, VER_NT_WORKSTATION,
+ 30 /* FIXME: Great, a reserved field with a value! */
},
/* WINXP */
{
sizeof(RTL_OSVERSIONINFOEXW), 5, 1, 0xA28, VER_PLATFORM_WIN32_NT,
- {'S','e','r','v','i','c','e',' ','P','a','c','k',' ','3',0},
- 3, 0, VER_SUITE_SINGLEUSERTS, VER_NT_WORKSTATION, 30 /* FIXME: Great, a reserved field with a value! */
+ L"Service Pack 3", 3, 0, VER_SUITE_SINGLEUSERTS, VER_NT_WORKSTATION,
+ 30 /* FIXME: Great, a reserved field with a value! */
},
/* WINXP64 */
{
sizeof(RTL_OSVERSIONINFOEXW), 5, 2, 0xECE, VER_PLATFORM_WIN32_NT,
- {'S','e','r','v','i','c','e',' ','P','a','c','k',' ','2',0},
- 2, 0, VER_SUITE_SINGLEUSERTS, VER_NT_WORKSTATION, 0
+ L"Service Pack 2", 2, 0, VER_SUITE_SINGLEUSERTS, VER_NT_WORKSTATION, 0
},
/* WIN2K3 */
{
sizeof(RTL_OSVERSIONINFOEXW), 5, 2, 0xECE, VER_PLATFORM_WIN32_NT,
- {'S','e','r','v','i','c','e',' ','P','a','c','k',' ','2',0},
- 2, 0, VER_SUITE_SINGLEUSERTS, VER_NT_SERVER, 0
+ L"Service Pack 2", 2, 0, VER_SUITE_SINGLEUSERTS, VER_NT_SERVER, 0
},
/* WINVISTA */
{
sizeof(RTL_OSVERSIONINFOEXW), 6, 0, 0x1772, VER_PLATFORM_WIN32_NT,
- {'S','e','r','v','i','c','e',' ','P','a','c','k',' ','2',0},
- 2, 0, VER_SUITE_SINGLEUSERTS, VER_NT_WORKSTATION, 0
+ L"Service Pack 2", 2, 0, VER_SUITE_SINGLEUSERTS, VER_NT_WORKSTATION, 0
},
/* WIN2K8 */
{
sizeof(RTL_OSVERSIONINFOEXW), 6, 0, 0x1772, VER_PLATFORM_WIN32_NT,
- {'S','e','r','v','i','c','e',' ','P','a','c','k',' ','2',0},
- 2, 0, VER_SUITE_SINGLEUSERTS, VER_NT_SERVER, 0
+ L"Service Pack 2", 2, 0, VER_SUITE_SINGLEUSERTS, VER_NT_SERVER, 0
},
/* WIN7 */
{
sizeof(RTL_OSVERSIONINFOEXW), 6, 1, 0x1DB1, VER_PLATFORM_WIN32_NT,
- {'S','e','r','v','i','c','e',' ','P','a','c','k',' ','1',0},
- 1, 0, VER_SUITE_SINGLEUSERTS, VER_NT_WORKSTATION, 0
+ L"Service Pack 1", 1, 0, VER_SUITE_SINGLEUSERTS, VER_NT_WORKSTATION, 0
},
/* WIN2K8R2 */
{
sizeof(RTL_OSVERSIONINFOEXW), 6, 1, 0x1DB1, VER_PLATFORM_WIN32_NT,
- {'S','e','r','v','i','c','e',' ','P','a','c','k',' ','1',0},
- 1, 0, VER_SUITE_SINGLEUSERTS, VER_NT_SERVER, 0
+ L"Service Pack 1", 1, 0, VER_SUITE_SINGLEUSERTS, VER_NT_SERVER, 0
},
/* WIN8 */
{
sizeof(RTL_OSVERSIONINFOEXW), 6, 2, 0x23F0, VER_PLATFORM_WIN32_NT,
- {0}, 0, 0, VER_SUITE_SINGLEUSERTS, VER_NT_WORKSTATION, 0
+ L"", 0, 0, VER_SUITE_SINGLEUSERTS, VER_NT_WORKSTATION, 0
},
/* WIN81 */
{
sizeof(RTL_OSVERSIONINFOEXW), 6, 3, 0x2580, VER_PLATFORM_WIN32_NT,
- {0}, 0, 0, VER_SUITE_SINGLEUSERTS, VER_NT_WORKSTATION, 0
+ L"", 0, 0, VER_SUITE_SINGLEUSERTS, VER_NT_WORKSTATION, 0
},
/* WIN10 */
{
sizeof(RTL_OSVERSIONINFOEXW), 10, 0, 0x4563, VER_PLATFORM_WIN32_NT,
- {0}, 0, 0, VER_SUITE_SINGLEUSERTS, VER_NT_WORKSTATION, 0
+ L"", 0, 0, VER_SUITE_SINGLEUSERTS, VER_NT_WORKSTATION, 0
},
};
static const struct { WCHAR name[12]; WINDOWS_VERSION ver; } version_names[] =
{
- { {'w','i','n','2','0',0}, WIN20 },
- { {'w','i','n','3','0',0}, WIN30 },
- { {'w','i','n','3','1',0}, WIN31 },
- { {'w','i','n','9','5',0}, WIN95 },
- { {'w','i','n','9','8',0}, WIN98 },
- { {'w','i','n','m','e',0}, WINME },
- { {'n','t','3','5','1',0}, NT351 },
- { {'n','t','4','0',0}, NT40 },
- { {'w','i','n','2','0','0','0',0}, NT2K },
- { {'w','i','n','2','k',0}, NT2K },
- { {'n','t','2','k',0}, NT2K },
- { {'n','t','2','0','0','0',0}, NT2K },
- { {'w','i','n','x','p',0}, WINXP },
- { {'w','i','n','x','p','6','4',0}, WINXP64 },
- { {'w','i','n','2','0','0','3',0}, WIN2K3 },
- { {'w','i','n','2','k','3',0}, WIN2K3 },
- { {'v','i','s','t','a',0}, WINVISTA },
- { {'w','i','n','v','i','s','t','a',0}, WINVISTA },
- { {'w','i','n','2','0','0','8',0}, WIN2K8 },
- { {'w','i','n','2','k','8',0}, WIN2K8 },
- { {'w','i','n','2','0','0','8','r','2',0}, WIN2K8R2 },
- { {'w','i','n','2','k','8','r','2',0}, WIN2K8R2 },
- { {'w','i','n','7',0}, WIN7 },
- { {'w','i','n','8',0}, WIN8 },
- { {'w','i','n','8','1',0}, WIN81 },
- { {'w','i','n','1','0',0}, WIN10 },
+ { L"win20", WIN20 },
+ { L"win30", WIN30 },
+ { L"win31", WIN31 },
+ { L"win95", WIN95 },
+ { L"win98", WIN98 },
+ { L"winme", WINME },
+ { L"nt351", NT351 },
+ { L"nt40", NT40 },
+ { L"win2000", NT2K },
+ { L"win2k", NT2K },
+ { L"nt2k", NT2K },
+ { L"nt2000", NT2K },
+ { L"winxp", WINXP },
+ { L"winxp64", WINXP64 },
+ { L"win2003", WIN2K3 },
+ { L"win2k3", WIN2K3 },
+ { L"vista", WINVISTA },
+ { L"winvista", WINVISTA },
+ { L"win2008", WIN2K8 },
+ { L"win2k8", WIN2K8 },
+ { L"win2008r2", WIN2K8R2 },
+ { L"win2k8r2", WIN2K8R2 },
+ { L"win7", WIN7 },
+ { L"win8", WIN8 },
+ { L"win81", WIN81 },
+ { L"win10", WIN10 },
};
@@ -229,29 +215,6 @@ static const RTL_OSVERSIONINFOEXW *current_version;
*/
static BOOL get_nt_registry_version( RTL_OSVERSIONINFOEXW *version )
{
- static const WCHAR version_keyW[] = {'M','a','c','h','i','n','e','\\',
- 'S','o','f','t','w','a','r','e','\\',
- 'M','i','c','r','o','s','o','f','t','\\',
- 'W','i','n','d','o','w','s',' ','N','T','\\',
- 'C','u','r','r','e','n','t','V','e','r','s','i','o','n',0};
- static const WCHAR service_pack_keyW[] = {'M','a','c','h','i','n','e','\\',
- 'S','y','s','t','e','m','\\',
- 'C','u','r','r','e','n','t','C','o','n','t','r','o','l','S','e','t','\\',
- 'C','o','n','t','r','o','l','\\',
- 'W','i','n','d','o','w','s',0};
- static const WCHAR product_keyW[] = {'M','a','c','h','i','n','e','\\',
- 'S','y','s','t','e','m','\\',
- 'C','u','r','r','e','n','t','C','o','n','t','r','o','l','S','e','t','\\',
- 'C','o','n','t','r','o','l','\\',
- 'P','r','o','d','u','c','t','O','p','t','i','o','n','s',0};
- static const WCHAR CurrentBuildNumberW[] = {'C','u','r','r','e','n','t','B','u','i','l','d','N','u','m','b','e','r',0};
- static const WCHAR CSDVersionW[] = {'C','S','D','V','e','r','s','i','o','n',0};
- static const WCHAR CurrentVersionW[] = {'C','u','r','r','e','n','t','V','e','r','s','i','o','n',0};
- static const WCHAR ProductTypeW[] = {'P','r','o','d','u','c','t','T','y','p','e',0};
- static const WCHAR WinNTW[] = {'W','i','n','N','T',0};
- static const WCHAR ServerNTW[] = {'S','e','r','v','e','r','N','T',0};
- static const WCHAR LanmanNTW[] = {'L','a','n','m','a','n','N','T',0};
-
OBJECT_ATTRIBUTES attr;
UNICODE_STRING nameW, valueW;
HANDLE hkey, hkey2;
@@ -266,13 +229,13 @@ static BOOL get_nt_registry_version( RTL_OSVERSIONINFOEXW *version )
attr.Attributes = 0;
attr.SecurityDescriptor = NULL;
attr.SecurityQualityOfService = NULL;
- RtlInitUnicodeString( &nameW, version_keyW );
+ RtlInitUnicodeString( &nameW, L"Machine\\Software\\Microsoft\\Windows NT\\CurrentVersion" );
if (NtOpenKey( &hkey, KEY_ALL_ACCESS, &attr )) return FALSE;
memset( version, 0, sizeof(*version) );
- RtlInitUnicodeString( &valueW, CurrentVersionW );
+ RtlInitUnicodeString( &valueW, L"CurrentVersion" );
if (!NtQueryValueKey( hkey, &valueW, KeyValuePartialInformation, tmp, sizeof(tmp)-1, &count ))
{
WCHAR *p, *str = (WCHAR *)info->Data;
@@ -293,7 +256,7 @@ static BOOL get_nt_registry_version( RTL_OSVERSIONINFOEXW *version )
/* get build number */
- RtlInitUnicodeString( &valueW, CurrentBuildNumberW );
+ RtlInitUnicodeString( &valueW, L"CurrentBuildNumber" );
if (!NtQueryValueKey( hkey, &valueW, KeyValuePartialInformation, tmp, sizeof(tmp)-1, &count ))
{
WCHAR *str = (WCHAR *)info->Data;
@@ -303,7 +266,7 @@ static BOOL get_nt_registry_version( RTL_OSVERSIONINFOEXW *version )
/* get version description */
- RtlInitUnicodeString( &valueW, CSDVersionW );
+ RtlInitUnicodeString( &valueW, L"CSDVersion" );
if (!NtQueryValueKey( hkey, &valueW, KeyValuePartialInformation, tmp, sizeof(tmp)-1, &count ))
{
DWORD len = min( info->DataLength, sizeof(version->szCSDVersion) - sizeof(WCHAR) );
@@ -313,10 +276,10 @@ static BOOL get_nt_registry_version( RTL_OSVERSIONINFOEXW *version )
/* get service pack version */
- RtlInitUnicodeString( &nameW, service_pack_keyW );
+ RtlInitUnicodeString( &nameW, L"Machine\\System\\CurrentControlSet\\Control\\Windows" );
if (!NtOpenKey( &hkey2, KEY_ALL_ACCESS, &attr ))
{
- RtlInitUnicodeString( &valueW, CSDVersionW );
+ RtlInitUnicodeString( &valueW, L"CSDVersion" );
if (!NtQueryValueKey( hkey2, &valueW, KeyValuePartialInformation, tmp, sizeof(tmp), &count ))
{
if (info->DataLength >= sizeof(DWORD))
@@ -331,17 +294,17 @@ static BOOL get_nt_registry_version( RTL_OSVERSIONINFOEXW *version )
/* get product type */
- RtlInitUnicodeString( &nameW, product_keyW );
+ RtlInitUnicodeString( &nameW, L"Machine\\System\\CurrentControlSet\\Control\\ProductOptions" );
if (!NtOpenKey( &hkey2, KEY_ALL_ACCESS, &attr ))
{
- RtlInitUnicodeString( &valueW, ProductTypeW );
+ RtlInitUnicodeString( &valueW, L"ProductType" );
if (!NtQueryValueKey( hkey2, &valueW, KeyValuePartialInformation, tmp, sizeof(tmp)-1, &count ))
{
WCHAR *str = (WCHAR *)info->Data;
str[info->DataLength / sizeof(WCHAR)] = 0;
- if (!wcsicmp( str, WinNTW )) version->wProductType = VER_NT_WORKSTATION;
- else if (!wcsicmp( str, LanmanNTW )) version->wProductType = VER_NT_DOMAIN_CONTROLLER;
- else if (!wcsicmp( str, ServerNTW )) version->wProductType = VER_NT_SERVER;
+ if (!wcsicmp( str, L"WinNT" )) version->wProductType = VER_NT_WORKSTATION;
+ else if (!wcsicmp( str, L"LanmanNT" )) version->wProductType = VER_NT_DOMAIN_CONTROLLER;
+ else if (!wcsicmp( str, L"ServerNT" )) version->wProductType = VER_NT_SERVER;
}
NtClose( hkey2 );
}
@@ -361,14 +324,6 @@ static BOOL get_nt_registry_version( RTL_OSVERSIONINFOEXW *version )
*/
static BOOL get_win9x_registry_version( RTL_OSVERSIONINFOEXW *version )
{
- static const WCHAR version_keyW[] = {'M','a','c','h','i','n','e','\\',
- 'S','o','f','t','w','a','r','e','\\',
- 'M','i','c','r','o','s','o','f','t','\\',
- 'W','i','n','d','o','w','s','\\',
- 'C','u','r','r','e','n','t','V','e','r','s','i','o','n',0};
- static const WCHAR VersionNumberW[] = {'V','e','r','s','i','o','n','N','u','m','b','e','r',0};
- static const WCHAR SubVersionNumberW[] = {'S','u','b','V','e','r','s','i','o','n','N','u','m','b','e','r',0};
-
OBJECT_ATTRIBUTES attr;
UNICODE_STRING nameW, valueW;
HANDLE hkey;
@@ -383,13 +338,13 @@ static BOOL get_win9x_registry_version( RTL_OSVERSIONINFOEXW *version )
attr.Attributes = 0;
attr.SecurityDescriptor = NULL;
attr.SecurityQualityOfService = NULL;
- RtlInitUnicodeString( &nameW, version_keyW );
+ RtlInitUnicodeString( &nameW, L"Machine\\Software\\Microsoft\\Windows\\CurrentVersion" );
if (NtOpenKey( &hkey, KEY_ALL_ACCESS, &attr )) return FALSE;
memset( version, 0, sizeof(*version) );
- RtlInitUnicodeString( &valueW, VersionNumberW );
+ RtlInitUnicodeString( &valueW, L"VersionNumber" );
if (!NtQueryValueKey( hkey, &valueW, KeyValuePartialInformation, tmp, sizeof(tmp)-1, &count ))
{
WCHAR *p, *str = (WCHAR *)info->Data;
@@ -417,7 +372,7 @@ static BOOL get_win9x_registry_version( RTL_OSVERSIONINFOEXW *version )
ret = TRUE;
version->dwPlatformId = VER_PLATFORM_WIN32_WINDOWS;
- RtlInitUnicodeString( &valueW, SubVersionNumberW );
+ RtlInitUnicodeString( &valueW, L"SubVersionNumber" );
if (!NtQueryValueKey( hkey, &valueW, KeyValuePartialInformation, tmp, sizeof(tmp)-1, &count ))
{
DWORD len = min( info->DataLength, sizeof(version->szCSDVersion) - sizeof(WCHAR) );
@@ -438,14 +393,12 @@ static BOOL get_win9x_registry_version( RTL_OSVERSIONINFOEXW *version )
*/
static BOOL parse_win_version( HANDLE hkey )
{
- static const WCHAR VersionW[] = {'V','e','r','s','i','o','n',0};
-
UNICODE_STRING valueW;
WCHAR *name, tmp[64];
KEY_VALUE_PARTIAL_INFORMATION *info = (KEY_VALUE_PARTIAL_INFORMATION *)tmp;
DWORD i, count;
- RtlInitUnicodeString( &valueW, VersionW );
+ RtlInitUnicodeString( &valueW, L"Version" );
if (NtQueryValueKey( hkey, &valueW, KeyValuePartialInformation, tmp, sizeof(tmp) - sizeof(WCHAR), &count ))
return FALSE;
@@ -470,8 +423,6 @@ static BOOL parse_win_version( HANDLE hkey )
*/
void version_init(void)
{
- static const WCHAR configW[] = {'S','o','f','t','w','a','r','e','\\','W','i','n','e',0};
- static const WCHAR appdefaultsW[] = {'A','p','p','D','e','f','a','u','l','t','s','\\',0};
OBJECT_ATTRIBUTES attr;
UNICODE_STRING nameW;
HANDLE root, hkey, config_key;
@@ -488,7 +439,7 @@ void version_init(void)
attr.Attributes = 0;
attr.SecurityDescriptor = NULL;
attr.SecurityQualityOfService = NULL;
- RtlInitUnicodeString( &nameW, configW );
+ RtlInitUnicodeString( &nameW, L"Software\\Wine" );
/* @@ Wine registry key: HKCU\Software\Wine */
if (NtOpenKey( &config_key, KEY_ALL_ACCESS, &attr )) config_key = 0;
@@ -500,7 +451,7 @@ void version_init(void)
if ((p = wcsrchr( appname, '/' ))) appname = p + 1;
if ((p = wcsrchr( appname, '\\' ))) appname = p + 1;
- wcscpy( appversion, appdefaultsW );
+ wcscpy( appversion, L"AppDefaults\\" );
wcscat( appversion, appname );
RtlInitUnicodeString( &nameW, appversion );
attr.RootDirectory = config_key;
--
2.26.2
1
0