kernel32: Use wide-char string literals.

Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Michael Stefaniuc 2020-11-17 00:55:16 +01:00 committed by Alexandre Julliard
parent 86e6c0bc28
commit c5ff8ff27e
10 changed files with 47 additions and 90 deletions

View File

@ -43,11 +43,9 @@ WINE_DEFAULT_DEBUG_CHANNEL(comm);
*/ */
static LPCWSTR COMM_ParseStart(LPCWSTR ptr) static LPCWSTR COMM_ParseStart(LPCWSTR ptr)
{ {
static const WCHAR comW[] = {'C','O','M',0};
/* The device control string may optionally start with "COMx" followed /* The device control string may optionally start with "COMx" followed
by an optional ':' and spaces. */ by an optional ':' and spaces. */
if(!wcsnicmp(ptr, comW, 3)) if(!wcsnicmp(ptr, L"COM", 3))
{ {
ptr += 3; ptr += 3;
@ -140,9 +138,8 @@ static LPCWSTR COMM_ParseByteSize(LPCWSTR ptr, LPBYTE lpbytesize)
static LPCWSTR COMM_ParseStopBits(LPCWSTR ptr, LPBYTE lpstopbits) static LPCWSTR COMM_ParseStopBits(LPCWSTR ptr, LPBYTE lpstopbits)
{ {
DWORD temp; DWORD temp;
static const WCHAR stopbits15W[] = {'1','.','5',0};
if(!wcsncmp(stopbits15W, ptr, 3)) if(!wcsncmp(L"1.5", ptr, 3))
{ {
ptr += 3; ptr += 3;
*lpstopbits = ONE5STOPBITS; *lpstopbits = ONE5STOPBITS;
@ -165,15 +162,12 @@ static LPCWSTR COMM_ParseStopBits(LPCWSTR ptr, LPBYTE lpstopbits)
static LPCWSTR COMM_ParseOnOff(LPCWSTR ptr, LPDWORD lponoff) static LPCWSTR COMM_ParseOnOff(LPCWSTR ptr, LPDWORD lponoff)
{ {
static const WCHAR onW[] = {'o','n',0}; if(!wcsnicmp(L"on", ptr, 2))
static const WCHAR offW[] = {'o','f','f',0};
if(!wcsnicmp(onW, ptr, 2))
{ {
ptr += 2; ptr += 2;
*lponoff = 1; *lponoff = 1;
} }
else if(!wcsnicmp(offW, ptr, 3)) else if(!wcsnicmp(L"off", ptr, 3))
{ {
ptr += 3; ptr += 3;
*lponoff = 0; *lponoff = 0;
@ -295,47 +289,36 @@ static BOOL COMM_BuildNewCommDCB(LPCWSTR device, LPDCB lpdcb, LPCOMMTIMEOUTS lpt
{ {
DWORD temp; DWORD temp;
BOOL baud = FALSE, stop = FALSE; BOOL baud = FALSE, stop = FALSE;
static const WCHAR baudW[] = {'b','a','u','d','=',0};
static const WCHAR parityW[] = {'p','a','r','i','t','y','=',0};
static const WCHAR dataW[] = {'d','a','t','a','=',0};
static const WCHAR stopW[] = {'s','t','o','p','=',0};
static const WCHAR toW[] = {'t','o','=',0};
static const WCHAR xonW[] = {'x','o','n','=',0};
static const WCHAR odsrW[] = {'o','d','s','r','=',0};
static const WCHAR octsW[] = {'o','c','t','s','=',0};
static const WCHAR dtrW[] = {'d','t','r','=',0};
static const WCHAR rtsW[] = {'r','t','s','=',0};
static const WCHAR idsrW[] = {'i','d','s','r','=',0};
while(*device) while(*device)
{ {
while(*device == ' ') device++; while(*device == ' ') device++;
if(!wcsnicmp(baudW, device, 5)) if(!wcsnicmp(L"baud=", device, 5))
{ {
baud = TRUE; baud = TRUE;
if(!(device = COMM_ParseNumber(device + 5, &lpdcb->BaudRate))) if(!(device = COMM_ParseNumber(device + 5, &lpdcb->BaudRate)))
return FALSE; return FALSE;
} }
else if(!wcsnicmp(parityW, device, 7)) else if(!wcsnicmp(L"parity=", device, 7))
{ {
if(!(device = COMM_ParseParity(device + 7, &lpdcb->Parity))) if(!(device = COMM_ParseParity(device + 7, &lpdcb->Parity)))
return FALSE; return FALSE;
} }
else if(!wcsnicmp(dataW, device, 5)) else if(!wcsnicmp(L"data=", device, 5))
{ {
if(!(device = COMM_ParseByteSize(device + 5, &lpdcb->ByteSize))) if(!(device = COMM_ParseByteSize(device + 5, &lpdcb->ByteSize)))
return FALSE; return FALSE;
} }
else if(!wcsnicmp(stopW, device, 5)) else if(!wcsnicmp(L"stop=", device, 5))
{ {
stop = TRUE; stop = TRUE;
if(!(device = COMM_ParseStopBits(device + 5, &lpdcb->StopBits))) if(!(device = COMM_ParseStopBits(device + 5, &lpdcb->StopBits)))
return FALSE; return FALSE;
} }
else if(!wcsnicmp(toW, device, 3)) else if(!wcsnicmp(L"to=", device, 3))
{ {
if(!(device = COMM_ParseOnOff(device + 3, &temp))) if(!(device = COMM_ParseOnOff(device + 3, &temp)))
return FALSE; return FALSE;
@ -346,7 +329,7 @@ static BOOL COMM_BuildNewCommDCB(LPCWSTR device, LPDCB lpdcb, LPCOMMTIMEOUTS lpt
lptimeouts->WriteTotalTimeoutMultiplier = 0; lptimeouts->WriteTotalTimeoutMultiplier = 0;
lptimeouts->WriteTotalTimeoutConstant = temp ? 60000 : 0; lptimeouts->WriteTotalTimeoutConstant = temp ? 60000 : 0;
} }
else if(!wcsnicmp(xonW, device, 4)) else if(!wcsnicmp(L"xon=", device, 4))
{ {
if(!(device = COMM_ParseOnOff(device + 4, &temp))) if(!(device = COMM_ParseOnOff(device + 4, &temp)))
return FALSE; return FALSE;
@ -354,35 +337,35 @@ static BOOL COMM_BuildNewCommDCB(LPCWSTR device, LPDCB lpdcb, LPCOMMTIMEOUTS lpt
lpdcb->fOutX = temp; lpdcb->fOutX = temp;
lpdcb->fInX = temp; lpdcb->fInX = temp;
} }
else if(!wcsnicmp(odsrW, device, 5)) else if(!wcsnicmp(L"odsr=", device, 5))
{ {
if(!(device = COMM_ParseOnOff(device + 5, &temp))) if(!(device = COMM_ParseOnOff(device + 5, &temp)))
return FALSE; return FALSE;
lpdcb->fOutxDsrFlow = temp; lpdcb->fOutxDsrFlow = temp;
} }
else if(!wcsnicmp(octsW, device, 5)) else if(!wcsnicmp(L"octs=", device, 5))
{ {
if(!(device = COMM_ParseOnOff(device + 5, &temp))) if(!(device = COMM_ParseOnOff(device + 5, &temp)))
return FALSE; return FALSE;
lpdcb->fOutxCtsFlow = temp; lpdcb->fOutxCtsFlow = temp;
} }
else if(!wcsnicmp(dtrW, device, 4)) else if(!wcsnicmp(L"dtr=", device, 4))
{ {
if(!(device = COMM_ParseOnOff(device + 4, &temp))) if(!(device = COMM_ParseOnOff(device + 4, &temp)))
return FALSE; return FALSE;
lpdcb->fDtrControl = temp; lpdcb->fDtrControl = temp;
} }
else if(!wcsnicmp(rtsW, device, 4)) else if(!wcsnicmp(L"rts=", device, 4))
{ {
if(!(device = COMM_ParseOnOff(device + 4, &temp))) if(!(device = COMM_ParseOnOff(device + 4, &temp)))
return FALSE; return FALSE;
lpdcb->fRtsControl = temp; lpdcb->fRtsControl = temp;
} }
else if(!wcsnicmp(idsrW, device, 5)) else if(!wcsnicmp(L"idsr=", device, 5))
{ {
if(!(device = COMM_ParseOnOff(device + 5, &temp))) if(!(device = COMM_ParseOnOff(device + 5, &temp)))
return FALSE; return FALSE;
@ -548,8 +531,7 @@ BOOL WINAPI BuildCommDCBW(
* The DLL should be loaded when the COMM port is opened, and closed * The DLL should be loaded when the COMM port is opened, and closed
* when the COMM port is closed. - MJM 20 June 2000 * when the COMM port is closed. - MJM 20 June 2000
***********************************************************************/ ***********************************************************************/
static const WCHAR lpszSerialUI[] = { static const WCHAR lpszSerialUI[] = L"serialui.dll";
's','e','r','i','a','l','u','i','.','d','l','l',0 };
/*********************************************************************** /***********************************************************************

View File

@ -45,9 +45,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(console); WINE_DEFAULT_DEBUG_CHANNEL(console);
static const WCHAR coninW[] = {'C','O','N','I','N','$',0};
static const WCHAR conoutW[] = {'C','O','N','O','U','T','$',0};
/****************************************************************************** /******************************************************************************
* GetConsoleWindow [KERNEL32.@] Get hwnd of the console window. * GetConsoleWindow [KERNEL32.@] Get hwnd of the console window.
* *
@ -79,7 +76,7 @@ HANDLE WINAPI OpenConsoleW(LPCWSTR name, DWORD access, BOOL inherit, DWORD creat
TRACE("(%s, 0x%08x, %d, %u)\n", debugstr_w(name), access, inherit, creation); TRACE("(%s, 0x%08x, %d, %u)\n", debugstr_w(name), access, inherit, creation);
if (!name || (wcsicmp( coninW, name ) && wcsicmp( conoutW, name )) || creation != OPEN_EXISTING) if (!name || (wcsicmp( L"CONIN$", name ) && wcsicmp( L"CONOUT$", name )) || creation != OPEN_EXISTING)
{ {
SetLastError( ERROR_INVALID_PARAMETER ); SetLastError( ERROR_INVALID_PARAMETER );
return INVALID_HANDLE_VALUE; return INVALID_HANDLE_VALUE;

View File

@ -73,8 +73,7 @@ void WINAPI DECLSPEC_HOTPATCH OutputDebugStringA( LPCSTR str )
if (!mutex_inited) if (!mutex_inited)
{ {
/* first call to OutputDebugString, initialize mutex handle */ /* first call to OutputDebugString, initialize mutex handle */
static const WCHAR mutexname[] = {'D','B','W','i','n','M','u','t','e','x',0}; HANDLE mutex = CreateMutexExW( NULL, L"DBWinMutex", 0, SYNCHRONIZE );
HANDLE mutex = CreateMutexExW( NULL, mutexname, 0, SYNCHRONIZE );
if (mutex) if (mutex)
{ {
if (InterlockedCompareExchangePointer( &DBWinMutex, mutex, 0 ) != 0) if (InterlockedCompareExchangePointer( &DBWinMutex, mutex, 0 ) != 0)
@ -86,20 +85,17 @@ void WINAPI DECLSPEC_HOTPATCH OutputDebugStringA( LPCSTR str )
if (DBWinMutex) if (DBWinMutex)
{ {
static const WCHAR shmname[] = {'D','B','W','I','N','_','B','U','F','F','E','R',0};
static const WCHAR eventbuffername[] = {'D','B','W','I','N','_','B','U','F','F','E','R','_','R','E','A','D','Y',0};
static const WCHAR eventdataname[] = {'D','B','W','I','N','_','D','A','T','A','_','R','E','A','D','Y',0};
HANDLE mapping; HANDLE mapping;
mapping = OpenFileMappingW( FILE_MAP_WRITE, FALSE, shmname ); mapping = OpenFileMappingW( FILE_MAP_WRITE, FALSE, L"DBWIN_BUFFER" );
if (mapping) if (mapping)
{ {
LPVOID buffer; LPVOID buffer;
HANDLE eventbuffer, eventdata; HANDLE eventbuffer, eventdata;
buffer = MapViewOfFile( mapping, FILE_MAP_WRITE, 0, 0, 0 ); buffer = MapViewOfFile( mapping, FILE_MAP_WRITE, 0, 0, 0 );
eventbuffer = OpenEventW( SYNCHRONIZE, FALSE, eventbuffername ); eventbuffer = OpenEventW( SYNCHRONIZE, FALSE, L"DBWIN_BUFFER_READY" );
eventdata = OpenEventW( EVENT_MODIFY_STATE, FALSE, eventdataname ); eventdata = OpenEventW( EVENT_MODIFY_STATE, FALSE, L"DBWIN_DATA_READY" );
if (buffer && eventbuffer && eventdata) if (buffer && eventbuffer && eventdata)
{ {

View File

@ -44,8 +44,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(file); WINE_DEFAULT_DEBUG_CHANNEL(file);
static const WCHAR krnl386W[] = {'k','r','n','l','3','8','6','.','e','x','e','1','6',0};
/*********************************************************************** /***********************************************************************
* create_file_OF * create_file_OF
* *
@ -452,7 +450,7 @@ BOOL WINAPI DeviceIoControl(HANDLE hDevice, DWORD dwIoControlCode,
static DeviceIoProc (*vxd_get_proc)(HANDLE); static DeviceIoProc (*vxd_get_proc)(HANDLE);
DeviceIoProc proc = NULL; DeviceIoProc proc = NULL;
if (!vxd_get_proc) vxd_get_proc = (void *)GetProcAddress( GetModuleHandleW(krnl386W), if (!vxd_get_proc) vxd_get_proc = (void *)GetProcAddress( GetModuleHandleW(L"krnl386.exe16"),
"__wine_vxd_get_proc" ); "__wine_vxd_get_proc" );
if (vxd_get_proc) proc = vxd_get_proc( hDevice ); if (vxd_get_proc) proc = vxd_get_proc( hDevice );
if (proc) return proc( dwIoControlCode, lpvInBuffer, cbInBuffer, if (proc) return proc( dwIoControlCode, lpvInBuffer, cbInBuffer,

View File

@ -672,9 +672,8 @@ static INT NLS_GetDateTimeFormatW(LCID lcid, DWORD dwFlags,
if (szAdd == buff && buff[0] == '\0') if (szAdd == buff && buff[0] == '\0')
{ {
static const WCHAR fmtW[] = {'%','.','*','d',0};
/* We have a numeric value to add */ /* We have a numeric value to add */
swprintf(buff, ARRAY_SIZE(buff), fmtW, count, dwVal); swprintf(buff, ARRAY_SIZE(buff), L"%.*d", count, dwVal);
} }
dwLen = szAdd ? lstrlenW(szAdd) : 0; dwLen = szAdd ? lstrlenW(szAdd) : 0;

View File

@ -165,8 +165,6 @@ BOOL WINAPI SetDllDirectoryW( LPCWSTR dir )
*/ */
BOOL WINAPI GetBinaryTypeW( LPCWSTR name, LPDWORD type ) BOOL WINAPI GetBinaryTypeW( LPCWSTR name, LPDWORD type )
{ {
static const WCHAR comW[] = { '.','c','o','m',0 };
static const WCHAR pifW[] = { '.','p','i','f',0 };
HANDLE hfile, mapping; HANDLE hfile, mapping;
NTSTATUS status; NTSTATUS status;
const WCHAR *ptr; const WCHAR *ptr;
@ -226,12 +224,12 @@ BOOL WINAPI GetBinaryTypeW( LPCWSTR name, LPDWORD type )
case STATUS_INVALID_IMAGE_NOT_MZ: case STATUS_INVALID_IMAGE_NOT_MZ:
if ((ptr = wcsrchr( name, '.' ))) if ((ptr = wcsrchr( name, '.' )))
{ {
if (!wcsicmp( ptr, comW )) if (!wcsicmp( ptr, L".com" ))
{ {
*type = SCS_DOS_BINARY; *type = SCS_DOS_BINARY;
return TRUE; return TRUE;
} }
if (!wcsicmp( ptr, pifW )) if (!wcsicmp( ptr, L".pif" ))
{ {
*type = SCS_PIF_BINARY; *type = SCS_PIF_BINARY;
return TRUE; return TRUE;

View File

@ -52,9 +52,8 @@ typedef struct
HMODULE kernel32_handle = 0; HMODULE kernel32_handle = 0;
SYSTEM_BASIC_INFORMATION system_info = { 0 }; SYSTEM_BASIC_INFORMATION system_info = { 0 };
const WCHAR DIR_Windows[] = {'C',':','\\','w','i','n','d','o','w','s',0}; const WCHAR DIR_Windows[] = L"C:\\windows";
const WCHAR DIR_System[] = {'C',':','\\','w','i','n','d','o','w','s', const WCHAR DIR_System[] = L"C:\\windows\\system32";
'\\','s','y','s','t','e','m','3','2',0};
/* Process flags */ /* Process flags */
#define PDB32_DEBUGGED 0x0001 /* Process is being debugged */ #define PDB32_DEBUGGED 0x0001 /* Process is being debugged */

View File

@ -78,9 +78,6 @@ static PROFILE *MRUProfile[N_CACHED_PROFILES]={NULL};
/* Check for comments in profile */ /* Check for comments in profile */
#define IS_ENTRY_COMMENT(str) ((str)[0] == ';') #define IS_ENTRY_COMMENT(str) ((str)[0] == ';')
static const WCHAR emptystringW[] = {0};
static const WCHAR wininiW[] = { 'w','i','n','.','i','n','i',0 };
static CRITICAL_SECTION PROFILE_CritSect; static CRITICAL_SECTION PROFILE_CritSect;
static CRITICAL_SECTION_DEBUG critsect_debug = static CRITICAL_SECTION_DEBUG critsect_debug =
{ {
@ -725,16 +722,15 @@ static BOOL PROFILE_Open( LPCWSTR filename, BOOL write_access )
} }
if (!filename) if (!filename)
filename = wininiW; filename = L"win.ini";
if ((RtlDetermineDosPathNameType_U(filename) == RELATIVE_PATH) && if ((RtlDetermineDosPathNameType_U(filename) == RELATIVE_PATH) &&
!wcschr(filename, '\\') && !wcschr(filename, '/')) !wcschr(filename, '\\') && !wcschr(filename, '/'))
{ {
static const WCHAR wszSeparator[] = {'\\', 0};
WCHAR windirW[MAX_PATH]; WCHAR windirW[MAX_PATH];
GetWindowsDirectoryW( windirW, MAX_PATH ); GetWindowsDirectoryW( windirW, MAX_PATH );
lstrcpyW(buffer, windirW); lstrcpyW(buffer, windirW);
lstrcatW(buffer, wszSeparator); lstrcatW(buffer, L"\\");
lstrcatW(buffer, filename); lstrcatW(buffer, filename);
} }
else else
@ -1015,17 +1011,14 @@ static BOOL PROFILE_SetString( LPCWSTR section_name, LPCWSTR key_name,
static HKEY open_file_mapping_key( const WCHAR *filename ) static HKEY open_file_mapping_key( const WCHAR *filename )
{ {
static const WCHAR mapping_pathW[] = {'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',
'\\','I','n','i','F','i','l','e','M','a','p','p','i','n','g',0};
static HKEY mapping_key; static HKEY mapping_key;
HKEY key; HKEY key;
EnterCriticalSection( &PROFILE_CritSect ); EnterCriticalSection( &PROFILE_CritSect );
if (!mapping_key && RegOpenKeyExW( HKEY_LOCAL_MACHINE, mapping_pathW, 0, KEY_WOW64_64KEY, &mapping_key )) if (!mapping_key && RegOpenKeyExW( HKEY_LOCAL_MACHINE,
L"Software\\Microsoft\\Windows NT\\CurrentVersion\\IniFileMapping",
0, KEY_WOW64_64KEY, &mapping_key ))
mapping_key = NULL; mapping_key = NULL;
LeaveCriticalSection( &PROFILE_CritSect ); LeaveCriticalSection( &PROFILE_CritSect );
@ -1073,7 +1066,6 @@ static WCHAR *get_key_value( HKEY key, const WCHAR *value )
static HKEY open_mapped_key( const WCHAR *path, BOOL write ) static HKEY open_mapped_key( const WCHAR *path, BOOL write )
{ {
static const WCHAR softwareW[] = {'S','o','f','t','w','a','r','e','\\',0};
static const WCHAR usrW[] = {'U','S','R',':'}; static const WCHAR usrW[] = {'U','S','R',':'};
static const WCHAR sysW[] = {'S','Y','S',':'}; static const WCHAR sysW[] = {'S','Y','S',':'};
WCHAR *combined_path; WCHAR *combined_path;
@ -1099,9 +1091,9 @@ static HKEY open_mapped_key( const WCHAR *path, BOOL write )
{ {
p += 4; p += 4;
if (!(combined_path = HeapAlloc( GetProcessHeap(), 0, if (!(combined_path = HeapAlloc( GetProcessHeap(), 0,
(ARRAY_SIZE( softwareW ) + lstrlenW( p )) * sizeof(WCHAR) ))) (ARRAY_SIZE( L"Software\\" ) + lstrlenW( p )) * sizeof(WCHAR) )))
return NULL; return NULL;
lstrcpyW( combined_path, softwareW ); lstrcpyW( combined_path, L"Software\\" );
lstrcatW( combined_path, p ); lstrcatW( combined_path, p );
if (write) if (write)
res = RegCreateKeyExW( HKEY_LOCAL_MACHINE, combined_path, 0, NULL, res = RegCreateKeyExW( HKEY_LOCAL_MACHINE, combined_path, 0, NULL,
@ -1120,7 +1112,6 @@ static HKEY open_mapped_key( const WCHAR *path, BOOL write )
static BOOL get_mapped_section_key( const WCHAR *filename, const WCHAR *section, static BOOL get_mapped_section_key( const WCHAR *filename, const WCHAR *section,
const WCHAR *name, BOOL write, HKEY *ret_key ) const WCHAR *name, BOOL write, HKEY *ret_key )
{ {
static const WCHAR backslashW[] = {'\\',0};
WCHAR *path = NULL, *combined_path; WCHAR *path = NULL, *combined_path;
HKEY key, subkey = NULL; HKEY key, subkey = NULL;
@ -1145,7 +1136,7 @@ static BOOL get_mapped_section_key( const WCHAR *filename, const WCHAR *section,
(lstrlenW( path ) + lstrlenW( section ) + 2) * sizeof(WCHAR) ))) (lstrlenW( path ) + lstrlenW( section ) + 2) * sizeof(WCHAR) )))
{ {
lstrcpyW( combined_path, path ); lstrcpyW( combined_path, path );
lstrcatW( combined_path, backslashW ); lstrcatW( combined_path, L"\\" );
lstrcatW( combined_path, section ); lstrcatW( combined_path, section );
} }
HeapFree( GetProcessHeap(), 0, path ); HeapFree( GetProcessHeap(), 0, path );
@ -1336,7 +1327,7 @@ UINT WINAPI GetProfileIntA( LPCSTR section, LPCSTR entry, INT def_val )
*/ */
UINT WINAPI GetProfileIntW( LPCWSTR section, LPCWSTR entry, INT def_val ) UINT WINAPI GetProfileIntW( LPCWSTR section, LPCWSTR entry, INT def_val )
{ {
return GetPrivateProfileIntW( section, entry, def_val, wininiW ); return GetPrivateProfileIntW( section, entry, def_val, L"win.ini" );
} }
/*********************************************************************** /***********************************************************************
@ -1346,7 +1337,6 @@ INT WINAPI GetPrivateProfileStringW( LPCWSTR section, LPCWSTR entry,
LPCWSTR def_val, LPWSTR buffer, LPCWSTR def_val, LPWSTR buffer,
UINT len, LPCWSTR filename ) UINT len, LPCWSTR filename )
{ {
static const WCHAR emptyW[] = {0};
int ret; int ret;
LPWSTR defval_tmp = NULL; LPWSTR defval_tmp = NULL;
const WCHAR *p; const WCHAR *p;
@ -1356,7 +1346,7 @@ INT WINAPI GetPrivateProfileStringW( LPCWSTR section, LPCWSTR entry,
debugstr_w(def_val), buffer, len, debugstr_w(filename)); debugstr_w(def_val), buffer, len, debugstr_w(filename));
if (!buffer || !len) return 0; if (!buffer || !len) return 0;
if (!def_val) def_val = emptyW; if (!def_val) def_val = L"";
if (!section) return GetPrivateProfileSectionNamesW( buffer, len, filename ); if (!section) return GetPrivateProfileSectionNamesW( buffer, len, filename );
if (!entry) if (!entry)
{ {
@ -1491,8 +1481,7 @@ INT WINAPI GetProfileStringA( LPCSTR section, LPCSTR entry, LPCSTR def_val,
INT WINAPI GetProfileStringW( LPCWSTR section, LPCWSTR entry, INT WINAPI GetProfileStringW( LPCWSTR section, LPCWSTR entry,
LPCWSTR def_val, LPWSTR buffer, UINT len ) LPCWSTR def_val, LPWSTR buffer, UINT len )
{ {
return GetPrivateProfileStringW( section, entry, def_val, return GetPrivateProfileStringW( section, entry, def_val, buffer, len, L"win.ini" );
buffer, len, wininiW );
} }
/*********************************************************************** /***********************************************************************
@ -1510,7 +1499,7 @@ BOOL WINAPI WriteProfileStringA( LPCSTR section, LPCSTR entry,
BOOL WINAPI WriteProfileStringW( LPCWSTR section, LPCWSTR entry, BOOL WINAPI WriteProfileStringW( LPCWSTR section, LPCWSTR entry,
LPCWSTR string ) LPCWSTR string )
{ {
return WritePrivateProfileStringW( section, entry, string, wininiW ); return WritePrivateProfileStringW( section, entry, string, L"win.ini" );
} }
@ -1524,7 +1513,7 @@ UINT WINAPI GetPrivateProfileIntW( LPCWSTR section, LPCWSTR entry,
UNICODE_STRING bufferW; UNICODE_STRING bufferW;
ULONG result; ULONG result;
if (GetPrivateProfileStringW( section, entry, emptystringW, buffer, ARRAY_SIZE( buffer ), if (GetPrivateProfileStringW( section, entry, L"", buffer, ARRAY_SIZE( buffer ),
filename ) == 0) filename ) == 0)
return def_val; return def_val;
@ -1638,7 +1627,7 @@ INT WINAPI GetProfileSectionA( LPCSTR section, LPSTR buffer, DWORD len )
*/ */
INT WINAPI GetProfileSectionW( LPCWSTR section, LPWSTR buffer, DWORD len ) INT WINAPI GetProfileSectionW( LPCWSTR section, LPWSTR buffer, DWORD len )
{ {
return GetPrivateProfileSectionW( section, buffer, len, wininiW ); return GetPrivateProfileSectionW( section, buffer, len, L"win.ini" );
} }
@ -1858,7 +1847,7 @@ BOOL WINAPI WriteProfileSectionA( LPCSTR section, LPCSTR keys_n_values)
*/ */
BOOL WINAPI WriteProfileSectionW( LPCWSTR section, LPCWSTR keys_n_values) BOOL WINAPI WriteProfileSectionW( LPCWSTR section, LPCWSTR keys_n_values)
{ {
return WritePrivateProfileSectionW(section, keys_n_values, wininiW); return WritePrivateProfileSectionW(section, keys_n_values, L"win.ini");
} }

View File

@ -981,7 +981,6 @@ static DWORD get_init_data_size( void *base, DWORD mapping_size )
static BOOL write_raw_resources( QUEUEDUPDATES *updates ) static BOOL write_raw_resources( QUEUEDUPDATES *updates )
{ {
static const WCHAR prefix[] = { 'r','e','s','u',0 };
WCHAR tempdir[MAX_PATH], tempfile[MAX_PATH]; WCHAR tempdir[MAX_PATH], tempfile[MAX_PATH];
DWORD i, section_size; DWORD i, section_size;
BOOL ret = FALSE; BOOL ret = FALSE;
@ -998,7 +997,7 @@ static BOOL write_raw_resources( QUEUEDUPDATES *updates )
if (!GetTempPathW( MAX_PATH, tempdir )) if (!GetTempPathW( MAX_PATH, tempdir ))
return ret; return ret;
if (!GetTempFileNameW( tempdir, prefix, 0, tempfile )) if (!GetTempFileNameW( tempdir, L"resu", 0, tempfile ))
return ret; return ret;
if (!CopyFileW( updates->pFileName, tempfile, FALSE )) if (!CopyFileW( updates->pFileName, tempfile, FALSE ))

View File

@ -210,7 +210,7 @@ static enum fs_type VOLUME_ReadCDSuperblock( HANDLE handle, BYTE *buff )
*/ */
BOOL WINAPI SetVolumeLabelW( LPCWSTR root, LPCWSTR label ) BOOL WINAPI SetVolumeLabelW( LPCWSTR root, LPCWSTR label )
{ {
WCHAR device[] = {'\\','\\','.','\\','A',':',0}; WCHAR device[] = L"\\\\.\\A:";
HANDLE handle; HANDLE handle;
enum fs_type type = FS_UNKNOWN; enum fs_type type = FS_UNKNOWN;
@ -266,7 +266,7 @@ BOOL WINAPI SetVolumeLabelW( LPCWSTR root, LPCWSTR label )
case DRIVE_REMOVABLE: case DRIVE_REMOVABLE:
case DRIVE_FIXED: case DRIVE_FIXED:
{ {
WCHAR labelW[] = {'A',':','\\','.','w','i','n','d','o','w','s','-','l','a','b','e','l',0}; WCHAR labelW[] = L"A:\\.windows-label";
labelW[0] = device[4]; labelW[0] = device[4];