Commit c487f21b authored by Alexandre Julliard's avatar Alexandre Julliard

advapi32: Build with msvcrt.

parent e9090e1c
...@@ -4,6 +4,8 @@ IMPORTLIB = advapi32 ...@@ -4,6 +4,8 @@ IMPORTLIB = advapi32
IMPORTS = kernelbase sechost IMPORTS = kernelbase sechost
DELAYIMPORTS = rpcrt4 DELAYIMPORTS = rpcrt4
EXTRADLLFLAGS = -mno-cygwin
C_SRCS = \ C_SRCS = \
advapi.c \ advapi.c \
cred.c \ cred.c \
......
...@@ -32,7 +32,6 @@ ...@@ -32,7 +32,6 @@
#include "wincred.h" #include "wincred.h"
#include "wct.h" #include "wct.h"
#include "wine/unicode.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "advapi32_misc.h" #include "advapi32_misc.h"
......
...@@ -24,21 +24,11 @@ ...@@ -24,21 +24,11 @@
* - Thread-safing * - Thread-safing
*/ */
#include "config.h"
#include "wine/port.h"
#include <limits.h> #include <limits.h>
#include <time.h> #include <time.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <sys/types.h> #include <sys/types.h>
#ifdef HAVE_SYS_STAT_H
# include <sys/stat.h>
#endif
#include <fcntl.h>
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#include "ntstatus.h" #include "ntstatus.h"
#define WIN32_NO_STATUS #define WIN32_NO_STATUS
...@@ -47,7 +37,6 @@ ...@@ -47,7 +37,6 @@
#include "winreg.h" #include "winreg.h"
#include "rpc.h" #include "rpc.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/unicode.h"
#include "winternl.h" #include "winternl.h"
WINE_DEFAULT_DEBUG_CHANNEL(crypt); WINE_DEFAULT_DEBUG_CHANNEL(crypt);
...@@ -79,11 +68,11 @@ static inline PWSTR CRYPT_GetProvKeyName(PCWSTR pProvName) ...@@ -79,11 +68,11 @@ static inline PWSTR CRYPT_GetProvKeyName(PCWSTR pProvName)
}; };
PWSTR keyname; PWSTR keyname;
keyname = CRYPT_Alloc((strlenW(KEYSTR) + strlenW(pProvName) +1)*sizeof(WCHAR)); keyname = CRYPT_Alloc((lstrlenW(KEYSTR) + lstrlenW(pProvName) +1)*sizeof(WCHAR));
if (keyname) if (keyname)
{ {
strcpyW(keyname, KEYSTR); lstrcpyW(keyname, KEYSTR);
strcpyW(keyname + strlenW(KEYSTR), pProvName); lstrcpyW(keyname + lstrlenW(KEYSTR), pProvName);
} else } else
SetLastError(ERROR_NOT_ENOUGH_MEMORY); SetLastError(ERROR_NOT_ENOUGH_MEMORY);
return keyname; return keyname;
...@@ -108,11 +97,11 @@ static inline PWSTR CRYPT_GetTypeKeyName(DWORD dwType, BOOL user) ...@@ -108,11 +97,11 @@ static inline PWSTR CRYPT_GetTypeKeyName(DWORD dwType, BOOL user)
PWSTR keyname; PWSTR keyname;
PWSTR ptr; PWSTR ptr;
keyname = CRYPT_Alloc( ((user ? strlenW(USERSTR) : strlenW(MACHINESTR)) +1)*sizeof(WCHAR)); keyname = CRYPT_Alloc( ((user ? lstrlenW(USERSTR) : lstrlenW(MACHINESTR)) +1)*sizeof(WCHAR));
if (keyname) if (keyname)
{ {
user ? strcpyW(keyname, USERSTR) : strcpyW(keyname, MACHINESTR); user ? lstrcpyW(keyname, USERSTR) : lstrcpyW(keyname, MACHINESTR);
ptr = keyname + strlenW(keyname); ptr = keyname + lstrlenW(keyname);
*(--ptr) = (dwType % 10) + '0'; *(--ptr) = (dwType % 10) + '0';
*(--ptr) = ((dwType / 10) % 10) + '0'; *(--ptr) = ((dwType / 10) % 10) + '0';
*(--ptr) = (dwType / 100) + '0'; *(--ptr) = (dwType / 100) + '0';
...@@ -303,19 +292,10 @@ static void CRYPT_CreateMachineGuid(void) ...@@ -303,19 +292,10 @@ static void CRYPT_CreateMachineGuid(void)
{ {
UUID uuid; UUID uuid;
WCHAR buf[37]; WCHAR buf[37];
RPC_STATUS rs;
static const WCHAR uuidFmt[] = { if (UuidCreate(&uuid) == S_OK)
'%','0','8','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 };
rs = UuidCreate(&uuid);
if (rs == S_OK)
{ {
sprintfW(buf, uuidFmt, swprintf(buf, ARRAY_SIZE(buf), L"%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
uuid.Data1, uuid.Data2, uuid.Data3, uuid.Data1, uuid.Data2, uuid.Data3,
uuid.Data4[0], uuid.Data4[1], uuid.Data4[0], uuid.Data4[1],
uuid.Data4[2], uuid.Data4[3], uuid.Data4[2], uuid.Data4[3],
...@@ -445,12 +425,12 @@ BOOL WINAPI CryptAcquireContextW (HCRYPTPROV *phProv, LPCWSTR pszContainer, ...@@ -445,12 +425,12 @@ BOOL WINAPI CryptAcquireContextW (HCRYPTPROV *phProv, LPCWSTR pszContainer,
} }
RegCloseKey(key); RegCloseKey(key);
} else { } else {
if ( !(provname = CRYPT_Alloc((strlenW(pszProvider) +1)*sizeof(WCHAR))) ) if ( !(provname = CRYPT_Alloc((lstrlenW(pszProvider) +1)*sizeof(WCHAR))) )
{ {
SetLastError(ERROR_NOT_ENOUGH_MEMORY); SetLastError(ERROR_NOT_ENOUGH_MEMORY);
goto error; goto error;
} }
strcpyW(provname, pszProvider); lstrcpyW(provname, pszProvider);
} }
keyname = CRYPT_GetProvKeyName(provname); keyname = CRYPT_GetProvKeyName(provname);
...@@ -1343,7 +1323,7 @@ BOOL WINAPI CryptEnumProviderTypesW (DWORD dwIndex, DWORD *pdwReserved, ...@@ -1343,7 +1323,7 @@ BOOL WINAPI CryptEnumProviderTypesW (DWORD dwIndex, DWORD *pdwReserved,
RegOpenKeyW(hKey, keyname, &hSubkey); RegOpenKeyW(hKey, keyname, &hSubkey);
RegCloseKey(hKey); RegCloseKey(hKey);
ch = keyname + strlenW(keyname); ch = keyname + lstrlenW(keyname);
/* Convert "Type 000" to 0, etc/ */ /* Convert "Type 000" to 0, etc/ */
*pdwProvType = *(--ch) - '0'; *pdwProvType = *(--ch) - '0';
*pdwProvType += (*(--ch) - '0') * 10; *pdwProvType += (*(--ch) - '0') * 10;
...@@ -2135,7 +2115,7 @@ BOOL WINAPI CryptSetProviderExW (LPCWSTR pszProvName, DWORD dwProvType, DWORD *p ...@@ -2135,7 +2115,7 @@ BOOL WINAPI CryptSetProviderExW (LPCWSTR pszProvName, DWORD dwProvType, DWORD *p
CRYPT_Free(keyname); CRYPT_Free(keyname);
if (RegSetValueExW(hTypeKey, nameW, 0, REG_SZ, (const BYTE *)pszProvName, if (RegSetValueExW(hTypeKey, nameW, 0, REG_SZ, (const BYTE *)pszProvName,
(strlenW(pszProvName) + 1)*sizeof(WCHAR))) (lstrlenW(pszProvName) + 1)*sizeof(WCHAR)))
{ {
RegCloseKey(hTypeKey); RegCloseKey(hTypeKey);
RegCloseKey(hProvKey); RegCloseKey(hProvKey);
......
...@@ -30,7 +30,6 @@ ...@@ -30,7 +30,6 @@
#include "evntrace.h" #include "evntrace.h"
#include "evntprov.h" #include "evntprov.h"
#include "wine/unicode.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "advapi32_misc.h" #include "advapi32_misc.h"
......
...@@ -33,7 +33,6 @@ ...@@ -33,7 +33,6 @@
#include "advapi32_misc.h" #include "advapi32_misc.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/unicode.h"
WINE_DEFAULT_DEBUG_CHANNEL(advapi); WINE_DEFAULT_DEBUG_CHANNEL(advapi);
...@@ -344,7 +343,7 @@ static LONG lsa_reflist_add_domain(LSA_REFERENCED_DOMAIN_LIST *list, LSA_UNICODE ...@@ -344,7 +343,7 @@ static LONG lsa_reflist_add_domain(LSA_REFERENCED_DOMAIN_LIST *list, LSA_UNICODE
{ {
/* try to reuse index */ /* try to reuse index */
if ((list->Domains[i].Name.Length == domain->Length) && if ((list->Domains[i].Name.Length == domain->Length) &&
(!strncmpiW(list->Domains[i].Name.Buffer, domain->Buffer, (domain->Length / sizeof(WCHAR))))) (!wcsnicmp(list->Domains[i].Name.Buffer, domain->Buffer, (domain->Length / sizeof(WCHAR)))))
{ {
return i; return i;
} }
...@@ -565,9 +564,9 @@ NTSTATUS WINAPI LsaLookupSids( ...@@ -565,9 +564,9 @@ NTSTATUS WINAPI LsaLookupSids(
} }
else if (ConvertSidToStringSidW(Sids[i], &strsid)) else if (ConvertSidToStringSidW(Sids[i], &strsid))
{ {
(*Names)[i].Name.Length = strlenW(strsid) * sizeof(WCHAR); (*Names)[i].Name.Length = lstrlenW(strsid) * sizeof(WCHAR);
(*Names)[i].Name.MaximumLength = (strlenW(strsid) + 1) * sizeof(WCHAR); (*Names)[i].Name.MaximumLength = (lstrlenW(strsid) + 1) * sizeof(WCHAR);
name_fullsize += (strlenW(strsid) + 1) * sizeof(WCHAR); name_fullsize += (lstrlenW(strsid) + 1) * sizeof(WCHAR);
LocalFree(strsid); LocalFree(strsid);
} }
...@@ -616,11 +615,11 @@ NTSTATUS WINAPI LsaLookupSids( ...@@ -616,11 +615,11 @@ NTSTATUS WINAPI LsaLookupSids(
} }
else if (ConvertSidToStringSidW(Sids[i], &strsid)) else if (ConvertSidToStringSidW(Sids[i], &strsid))
{ {
strcpyW((*Names)[i].Name.Buffer, strsid); lstrcpyW((*Names)[i].Name.Buffer, strsid);
LocalFree(strsid); LocalFree(strsid);
} }
name_buffer += strlenW(name_buffer) + 1; name_buffer += lstrlenW(name_buffer) + 1;
} }
TRACE("mapped %u out of %u\n", mapped, Count); TRACE("mapped %u out of %u\n", mapped, Count);
...@@ -806,11 +805,11 @@ NTSTATUS WINAPI LsaQueryInformationPolicy( ...@@ -806,11 +805,11 @@ NTSTATUS WINAPI LsaQueryInformationPolicy(
{ {
WCHAR *dot; WCHAR *dot;
dot = strrchrW(xdi->domain_name, '.'); dot = wcsrchr(xdi->domain_name, '.');
if (dot) *dot = 0; if (dot) *dot = 0;
struprW(xdi->domain_name); wcsupr(xdi->domain_name);
xdi->info.Name.Buffer = xdi->domain_name; xdi->info.Name.Buffer = xdi->domain_name;
xdi->info.Name.Length = strlenW(xdi->domain_name) * sizeof(WCHAR); xdi->info.Name.Length = lstrlenW(xdi->domain_name) * sizeof(WCHAR);
xdi->info.Name.MaximumLength = xdi->info.Name.Length + sizeof(WCHAR); xdi->info.Name.MaximumLength = xdi->info.Name.Length + sizeof(WCHAR);
TRACE("setting Name to %s\n", debugstr_w(xdi->info.Name.Buffer)); TRACE("setting Name to %s\n", debugstr_w(xdi->info.Name.Buffer));
} }
...@@ -1064,7 +1063,7 @@ NTSTATUS WINAPI LsaLookupPrivilegeName(LSA_HANDLE handle, LUID *luid, LSA_UNICOD ...@@ -1064,7 +1063,7 @@ NTSTATUS WINAPI LsaLookupPrivilegeName(LSA_HANDLE handle, LUID *luid, LSA_UNICOD
if (!(privnameW = get_wellknown_privilege_name(luid))) if (!(privnameW = get_wellknown_privilege_name(luid)))
return STATUS_NO_SUCH_PRIVILEGE; return STATUS_NO_SUCH_PRIVILEGE;
length = strlenW(privnameW); length = lstrlenW(privnameW);
*name = heap_alloc(sizeof(**name) + (length + 1) * sizeof(WCHAR)); *name = heap_alloc(sizeof(**name) + (length + 1) * sizeof(WCHAR));
if (!*name) if (!*name)
return STATUS_NO_MEMORY; return STATUS_NO_MEMORY;
......
...@@ -36,7 +36,6 @@ ...@@ -36,7 +36,6 @@
#include "winerror.h" #include "winerror.h"
#include "winternl.h" #include "winternl.h"
#include "wine/unicode.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/list.h" #include "wine/list.h"
...@@ -365,7 +364,7 @@ LSTATUS WINAPI RegSetValueW( HKEY hkey, LPCWSTR subkey, DWORD type, LPCWSTR data ...@@ -365,7 +364,7 @@ LSTATUS WINAPI RegSetValueW( HKEY hkey, LPCWSTR subkey, DWORD type, LPCWSTR data
if (type != REG_SZ || !data) return ERROR_INVALID_PARAMETER; if (type != REG_SZ || !data) return ERROR_INVALID_PARAMETER;
return RegSetKeyValueW( hkey, subkey, NULL, type, data, (strlenW(data) + 1)*sizeof(WCHAR) ); return RegSetKeyValueW( hkey, subkey, NULL, type, data, (lstrlenW(data) + 1)*sizeof(WCHAR) );
} }
/****************************************************************************** /******************************************************************************
...@@ -576,7 +575,7 @@ LSTATUS WINAPI RegConnectRegistryW( LPCWSTR lpMachineName, HKEY hKey, ...@@ -576,7 +575,7 @@ LSTATUS WINAPI RegConnectRegistryW( LPCWSTR lpMachineName, HKEY hKey,
lpMachineName += 2; lpMachineName += 2;
if (GetComputerNameW(compName, &len)) if (GetComputerNameW(compName, &len))
{ {
if (!strcmpiW(lpMachineName, compName)) if (!wcsicmp(lpMachineName, compName))
ret = RegOpenKeyW(hKey, NULL, phkResult); ret = RegOpenKeyW(hKey, NULL, phkResult);
else else
{ {
......
...@@ -19,8 +19,6 @@ ...@@ -19,8 +19,6 @@
* *
*/ */
#include "config.h"
#include <stdarg.h> #include <stdarg.h>
#include <string.h> #include <string.h>
...@@ -43,7 +41,6 @@ ...@@ -43,7 +41,6 @@
#include "lmcons.h" #include "lmcons.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/unicode.h"
WINE_DEFAULT_DEBUG_CHANNEL(advapi); WINE_DEFAULT_DEBUG_CHANNEL(advapi);
...@@ -272,18 +269,18 @@ static inline DWORD get_security_regkey( LPWSTR full_key_name, DWORD access, HAN ...@@ -272,18 +269,18 @@ static inline DWORD get_security_regkey( LPWSTR full_key_name, DWORD access, HAN
static const WCHAR current_userW[] = {'C','U','R','R','E','N','T','_','U','S','E','R',0}; static const WCHAR current_userW[] = {'C','U','R','R','E','N','T','_','U','S','E','R',0};
static const WCHAR machineW[] = {'M','A','C','H','I','N','E',0}; static const WCHAR machineW[] = {'M','A','C','H','I','N','E',0};
static const WCHAR usersW[] = {'U','S','E','R','S',0}; static const WCHAR usersW[] = {'U','S','E','R','S',0};
LPWSTR p = strchrW(full_key_name, '\\'); LPWSTR p = wcschr(full_key_name, '\\');
int len = p-full_key_name; int len = p-full_key_name;
HKEY hParent; HKEY hParent;
if (!p) return ERROR_INVALID_PARAMETER; if (!p) return ERROR_INVALID_PARAMETER;
if (strncmpW( full_key_name, classes_rootW, len ) == 0) if (wcsncmp( full_key_name, classes_rootW, len ) == 0)
hParent = HKEY_CLASSES_ROOT; hParent = HKEY_CLASSES_ROOT;
else if (strncmpW( full_key_name, current_userW, len ) == 0) else if (wcsncmp( full_key_name, current_userW, len ) == 0)
hParent = HKEY_CURRENT_USER; hParent = HKEY_CURRENT_USER;
else if (strncmpW( full_key_name, machineW, len ) == 0) else if (wcsncmp( full_key_name, machineW, len ) == 0)
hParent = HKEY_LOCAL_MACHINE; hParent = HKEY_LOCAL_MACHINE;
else if (strncmpW( full_key_name, usersW, len ) == 0) else if (wcsncmp( full_key_name, usersW, len ) == 0)
hParent = HKEY_USERS; hParent = HKEY_USERS;
else else
return ERROR_INVALID_PARAMETER; return ERROR_INVALID_PARAMETER;
...@@ -309,7 +306,7 @@ BOOL ADVAPI_IsLocalComputer(LPCWSTR ServerName) ...@@ -309,7 +306,7 @@ BOOL ADVAPI_IsLocalComputer(LPCWSTR ServerName)
Result = GetComputerNameW(buf, &dwSize); Result = GetComputerNameW(buf, &dwSize);
if (Result && (ServerName[0] == '\\') && (ServerName[1] == '\\')) if (Result && (ServerName[0] == '\\') && (ServerName[1] == '\\'))
ServerName += 2; ServerName += 2;
Result = Result && !lstrcmpW(ServerName, buf); Result = Result && !wcscmp(ServerName, buf);
heap_free(buf); heap_free(buf);
return Result; return Result;
...@@ -652,7 +649,7 @@ LookupPrivilegeValueW( LPCWSTR lpSystemName, LPCWSTR lpName, PLUID lpLuid ) ...@@ -652,7 +649,7 @@ LookupPrivilegeValueW( LPCWSTR lpSystemName, LPCWSTR lpName, PLUID lpLuid )
{ {
if( !WellKnownPrivNames[i] ) if( !WellKnownPrivNames[i] )
continue; continue;
if( strcmpiW( WellKnownPrivNames[i], lpName) ) if( wcsicmp( WellKnownPrivNames[i], lpName) )
continue; continue;
lpLuid->LowPart = i; lpLuid->LowPart = i;
lpLuid->HighPart = 0; lpLuid->HighPart = 0;
...@@ -809,7 +806,7 @@ LookupPrivilegeNameW( LPCWSTR lpSystemName, PLUID lpLuid, LPWSTR lpName, ...@@ -809,7 +806,7 @@ LookupPrivilegeNameW( LPCWSTR lpSystemName, PLUID lpLuid, LPWSTR lpName,
SetLastError(ERROR_NO_SUCH_PRIVILEGE); SetLastError(ERROR_NO_SUCH_PRIVILEGE);
return FALSE; return FALSE;
} }
privNameLen = strlenW(WellKnownPrivNames[lpLuid->LowPart]); privNameLen = lstrlenW(WellKnownPrivNames[lpLuid->LowPart]);
/* Windows crashes if cchName is NULL, so will I */ /* Windows crashes if cchName is NULL, so will I */
if (*cchName <= privNameLen) if (*cchName <= privNameLen)
{ {
...@@ -819,7 +816,7 @@ LookupPrivilegeNameW( LPCWSTR lpSystemName, PLUID lpLuid, LPWSTR lpName, ...@@ -819,7 +816,7 @@ LookupPrivilegeNameW( LPCWSTR lpSystemName, PLUID lpLuid, LPWSTR lpName,
} }
else else
{ {
strcpyW(lpName, WellKnownPrivNames[lpLuid->LowPart]); lstrcpyW(lpName, WellKnownPrivNames[lpLuid->LowPart]);
*cchName = privNameLen; *cchName = privNameLen;
return TRUE; return TRUE;
} }
...@@ -1277,7 +1274,7 @@ static BOOL lookup_user_account_name(PSID Sid, PDWORD cbSid, LPWSTR ReferencedDo ...@@ -1277,7 +1274,7 @@ static BOOL lookup_user_account_name(PSID Sid, PDWORD cbSid, LPWSTR ReferencedDo
ret = FALSE; ret = FALSE;
} }
else if (ReferencedDomainName) else if (ReferencedDomainName)
strcpyW(ReferencedDomainName, domainName); lstrcpyW(ReferencedDomainName, domainName);
*cchReferencedDomainName = nameLen; *cchReferencedDomainName = nameLen;
...@@ -1323,7 +1320,7 @@ static BOOL lookup_computer_account_name(PSID Sid, PDWORD cbSid, LPWSTR Referenc ...@@ -1323,7 +1320,7 @@ static BOOL lookup_computer_account_name(PSID Sid, PDWORD cbSid, LPWSTR Referenc
ret = FALSE; ret = FALSE;
} }
else if (ReferencedDomainName) else if (ReferencedDomainName)
strcpyW(ReferencedDomainName, domainName); lstrcpyW(ReferencedDomainName, domainName);
*cchReferencedDomainName = nameLen; *cchReferencedDomainName = nameLen;
...@@ -1360,9 +1357,9 @@ static void split_domain_account( const LSA_UNICODE_STRING *str, LSA_UNICODE_STR ...@@ -1360,9 +1357,9 @@ static void split_domain_account( const LSA_UNICODE_STRING *str, LSA_UNICODE_STR
static BOOL match_domain( ULONG idx, const LSA_UNICODE_STRING *domain ) static BOOL match_domain( ULONG idx, const LSA_UNICODE_STRING *domain )
{ {
ULONG len = strlenW( ACCOUNT_SIDS[idx].domain ); ULONG len = lstrlenW( ACCOUNT_SIDS[idx].domain );
if (len == domain->Length / sizeof(WCHAR) && !strncmpiW( domain->Buffer, ACCOUNT_SIDS[idx].domain, len )) if (len == domain->Length / sizeof(WCHAR) && !wcsnicmp( domain->Buffer, ACCOUNT_SIDS[idx].domain, len ))
return TRUE; return TRUE;
return FALSE; return FALSE;
...@@ -1370,15 +1367,15 @@ static BOOL match_domain( ULONG idx, const LSA_UNICODE_STRING *domain ) ...@@ -1370,15 +1367,15 @@ static BOOL match_domain( ULONG idx, const LSA_UNICODE_STRING *domain )
static BOOL match_account( ULONG idx, const LSA_UNICODE_STRING *account ) static BOOL match_account( ULONG idx, const LSA_UNICODE_STRING *account )
{ {
ULONG len = strlenW( ACCOUNT_SIDS[idx].account ); ULONG len = lstrlenW( ACCOUNT_SIDS[idx].account );
if (len == account->Length / sizeof(WCHAR) && !strncmpiW( account->Buffer, ACCOUNT_SIDS[idx].account, len )) if (len == account->Length / sizeof(WCHAR) && !wcsnicmp( account->Buffer, ACCOUNT_SIDS[idx].account, len ))
return TRUE; return TRUE;
if (ACCOUNT_SIDS[idx].alias) if (ACCOUNT_SIDS[idx].alias)
{ {
len = strlenW( ACCOUNT_SIDS[idx].alias ); len = lstrlenW( ACCOUNT_SIDS[idx].alias );
if (len == account->Length / sizeof(WCHAR) && !strncmpiW( account->Buffer, ACCOUNT_SIDS[idx].alias, len )) if (len == account->Length / sizeof(WCHAR) && !wcsnicmp( account->Buffer, ACCOUNT_SIDS[idx].alias, len ))
return TRUE; return TRUE;
} }
return FALSE; return FALSE;
...@@ -1426,7 +1423,7 @@ BOOL lookup_local_wellknown_name( const LSA_UNICODE_STRING *account_and_domain, ...@@ -1426,7 +1423,7 @@ BOOL lookup_local_wellknown_name( const LSA_UNICODE_STRING *account_and_domain,
*cbSid = sidLen; *cbSid = sidLen;
} }
len = strlenW( ACCOUNT_SIDS[i].domain ); len = lstrlenW( ACCOUNT_SIDS[i].domain );
if (*cchReferencedDomainName <= len || !ret) if (*cchReferencedDomainName <= len || !ret)
{ {
SetLastError(ERROR_INSUFFICIENT_BUFFER); SetLastError(ERROR_INSUFFICIENT_BUFFER);
...@@ -1435,7 +1432,7 @@ BOOL lookup_local_wellknown_name( const LSA_UNICODE_STRING *account_and_domain, ...@@ -1435,7 +1432,7 @@ BOOL lookup_local_wellknown_name( const LSA_UNICODE_STRING *account_and_domain,
} }
else if (ReferencedDomainName) else if (ReferencedDomainName)
{ {
strcpyW( ReferencedDomainName, ACCOUNT_SIDS[i].domain ); lstrcpyW( ReferencedDomainName, ACCOUNT_SIDS[i].domain );
} }
*cchReferencedDomainName = len; *cchReferencedDomainName = len;
...@@ -1473,7 +1470,7 @@ BOOL lookup_local_user_name( const LSA_UNICODE_STRING *account_and_domain, ...@@ -1473,7 +1470,7 @@ BOOL lookup_local_user_name( const LSA_UNICODE_STRING *account_and_domain,
{ {
/* check to make sure this account is on this computer */ /* check to make sure this account is on this computer */
if (GetComputerNameW( userName, &nameLen ) && if (GetComputerNameW( userName, &nameLen ) &&
(domain.Length / sizeof(WCHAR) != nameLen || strncmpW( domain.Buffer, userName, nameLen ))) (domain.Length / sizeof(WCHAR) != nameLen || wcsncmp( domain.Buffer, userName, nameLen )))
{ {
SetLastError(ERROR_NONE_MAPPED); SetLastError(ERROR_NONE_MAPPED);
ret = FALSE; ret = FALSE;
...@@ -1482,7 +1479,7 @@ BOOL lookup_local_user_name( const LSA_UNICODE_STRING *account_and_domain, ...@@ -1482,7 +1479,7 @@ BOOL lookup_local_user_name( const LSA_UNICODE_STRING *account_and_domain,
} }
if (GetUserNameW( userName, &nameLen ) && if (GetUserNameW( userName, &nameLen ) &&
account.Length / sizeof(WCHAR) == nameLen - 1 && !strncmpW( account.Buffer, userName, nameLen - 1 )) account.Length / sizeof(WCHAR) == nameLen - 1 && !wcsncmp( account.Buffer, userName, nameLen - 1 ))
{ {
ret = lookup_user_account_name( Sid, cbSid, ReferencedDomainName, cchReferencedDomainName, peUse ); ret = lookup_user_account_name( Sid, cbSid, ReferencedDomainName, cchReferencedDomainName, peUse );
*handled = TRUE; *handled = TRUE;
...@@ -1491,7 +1488,7 @@ BOOL lookup_local_user_name( const LSA_UNICODE_STRING *account_and_domain, ...@@ -1491,7 +1488,7 @@ BOOL lookup_local_user_name( const LSA_UNICODE_STRING *account_and_domain,
{ {
nameLen = UNLEN + 1; nameLen = UNLEN + 1;
if (GetComputerNameW( userName, &nameLen ) && if (GetComputerNameW( userName, &nameLen ) &&
account.Length / sizeof(WCHAR) == nameLen && !strncmpW( account.Buffer, userName , nameLen )) account.Length / sizeof(WCHAR) == nameLen && !wcsncmp( account.Buffer, userName , nameLen ))
{ {
ret = lookup_computer_account_name( Sid, cbSid, ReferencedDomainName, cchReferencedDomainName, peUse ); ret = lookup_computer_account_name( Sid, cbSid, ReferencedDomainName, cchReferencedDomainName, peUse );
*handled = TRUE; *handled = TRUE;
...@@ -1522,7 +1519,7 @@ BOOL WINAPI LookupAccountNameW( LPCWSTR lpSystemName, LPCWSTR lpAccountName, PSI ...@@ -1522,7 +1519,7 @@ BOOL WINAPI LookupAccountNameW( LPCWSTR lpSystemName, LPCWSTR lpAccountName, PSI
return FALSE; return FALSE;
} }
if (!lpAccountName || !strcmpW( lpAccountName, Blank )) if (!lpAccountName || !wcscmp( lpAccountName, Blank ))
{ {
lpAccountName = BUILTIN; lpAccountName = BUILTIN;
} }
...@@ -2149,7 +2146,7 @@ static DWORD trustee_to_sid( DWORD nDestinationSidLength, PSID pDestinationSid, ...@@ -2149,7 +2146,7 @@ static DWORD trustee_to_sid( DWORD nDestinationSidLength, PSID pDestinationSid,
DWORD sid_size = nDestinationSidLength; DWORD sid_size = nDestinationSidLength;
DWORD domain_size = MAX_COMPUTERNAME_LENGTH + 1; DWORD domain_size = MAX_COMPUTERNAME_LENGTH + 1;
SID_NAME_USE use; SID_NAME_USE use;
if (!strcmpW( pTrustee->ptstrName, CURRENT_USER )) if (!wcscmp( pTrustee->ptstrName, CURRENT_USER ))
{ {
if (!lookup_user_account_name( pDestinationSid, &sid_size, NULL, &domain_size, &use )) if (!lookup_user_account_name( pDestinationSid, &sid_size, NULL, &domain_size, &use ))
{ {
......
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
#include "windef.h" #include "windef.h"
#include "winbase.h" #include "winbase.h"
#include "winsvc.h" #include "winsvc.h"
#include "wine/unicode.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "advapi32_misc.h" #include "advapi32_misc.h"
...@@ -168,9 +167,9 @@ EnumServicesStatusW( SC_HANDLE manager, DWORD type, DWORD state, ENUM_SERVICE_ST ...@@ -168,9 +167,9 @@ EnumServicesStatusW( SC_HANDLE manager, DWORD type, DWORD state, ENUM_SERVICE_ST
for (i = 0; i < count; i++) for (i = 0; i < count; i++)
{ {
*ret_size += sizeof(ENUM_SERVICE_STATUSW); *ret_size += sizeof(ENUM_SERVICE_STATUSW);
*ret_size += (strlenW( status_ex[i].lpServiceName ) + 1) * sizeof(WCHAR); *ret_size += (lstrlenW( status_ex[i].lpServiceName ) + 1) * sizeof(WCHAR);
if (status_ex[i].lpDisplayName) if (status_ex[i].lpDisplayName)
*ret_size += (strlenW( status_ex[i].lpDisplayName ) + 1) * sizeof(WCHAR); *ret_size += (lstrlenW( status_ex[i].lpDisplayName ) + 1) * sizeof(WCHAR);
if (*ret_size <= size) if (*ret_size <= size)
++*ret_count; ++*ret_count;
...@@ -179,14 +178,14 @@ EnumServicesStatusW( SC_HANDLE manager, DWORD type, DWORD state, ENUM_SERVICE_ST ...@@ -179,14 +178,14 @@ EnumServicesStatusW( SC_HANDLE manager, DWORD type, DWORD state, ENUM_SERVICE_ST
p = (WCHAR *)(status + *ret_count); p = (WCHAR *)(status + *ret_count);
for (i = 0; i < *ret_count; i++) for (i = 0; i < *ret_count; i++)
{ {
strcpyW( p, status_ex[i].lpServiceName ); lstrcpyW( p, status_ex[i].lpServiceName );
status[i].lpServiceName = (WCHAR *)p; status[i].lpServiceName = (WCHAR *)p;
p += strlenW( p ) + 1; p += lstrlenW( p ) + 1;
if (status_ex[i].lpDisplayName) if (status_ex[i].lpDisplayName)
{ {
strcpyW( p, status_ex[i].lpDisplayName ); lstrcpyW( p, status_ex[i].lpDisplayName );
status[i].lpDisplayName = (WCHAR *)p; status[i].lpDisplayName = (WCHAR *)p;
p += strlenW( p ) + 1; p += lstrlenW( p ) + 1;
} }
else status[i].lpDisplayName = NULL; else status[i].lpDisplayName = NULL;
......
...@@ -29,7 +29,6 @@ ...@@ -29,7 +29,6 @@
#define _WMI_SOURCE_ #define _WMI_SOURCE_
#include "wmium.h" #include "wmium.h"
#include "wine/unicode.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "advapi32_misc.h" #include "advapi32_misc.h"
......
...@@ -4044,7 +4044,7 @@ START_TEST(loader) ...@@ -4044,7 +4044,7 @@ START_TEST(loader)
test_wow64_redirection(); test_wow64_redirection();
test_dll_file( "ntdll.dll", FALSE ); test_dll_file( "ntdll.dll", FALSE );
test_dll_file( "kernel32.dll", TRUE ); test_dll_file( "kernel32.dll", TRUE );
test_dll_file( "advapi32.dll", TRUE ); test_dll_file( "advapi32.dll", FALSE );
test_dll_file( "user32.dll", TRUE ); test_dll_file( "user32.dll", TRUE );
/* loader test must be last, it can corrupt the internal loader state on Windows */ /* loader test must be last, it can corrupt the internal loader state on Windows */
test_Loader(); test_Loader();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment