Commit 72d6759f authored by Alexandre Julliard's avatar Alexandre Julliard

setupapi: Build with msvcrt.

parent 4a848304
......@@ -4,6 +4,8 @@ IMPORTLIB = setupapi
IMPORTS = uuid version advapi32 rpcrt4
DELAYIMPORTS = shell32 wintrust ole32 winspool comdlg32 user32
EXTRADLLFLAGS = -mno-cygwin
C_SRCS = \
devinst.c \
dialog.c \
......
......@@ -31,8 +31,6 @@
#include "winnls.h"
#include "setupapi_private.h"
#include "wine/unicode.h"
WINE_DEFAULT_DEBUG_CHANNEL(setupapi);
struct promptdisk_params {
......@@ -98,7 +96,7 @@ static void promptdisk_ok(HWND hwnd, struct promptdisk_params *params)
int requiredSize;
WCHAR aux[MAX_PATH];
GetWindowTextW(GetDlgItem(hwnd, IDC_PATH), aux, MAX_PATH);
requiredSize = strlenW(aux)+1;
requiredSize = lstrlenW(aux)+1;
if(params->PathRequiredSize)
{
......@@ -115,7 +113,7 @@ static void promptdisk_ok(HWND hwnd, struct promptdisk_params *params)
EndDialog(hwnd, DPROMPT_BUFFERTOOSMALL);
return;
}
strcpyW(params->PathBuffer, aux);
lstrcpyW(params->PathBuffer, aux);
TRACE("returning PathBuffer=%s\n", debugstr_w(params->PathBuffer));
EndDialog(hwnd, DPROMPT_SUCCESS);
}
......@@ -133,11 +131,11 @@ static void promptdisk_browse(HWND hwnd, struct promptdisk_params *params)
ofn.hwndOwner = hwnd;
ofn.nMaxFile = MAX_PATH;
ofn.lpstrFile = HeapAlloc(GetProcessHeap(), 0, MAX_PATH*sizeof(WCHAR));
strcpyW(ofn.lpstrFile, params->FileSought);
lstrcpyW(ofn.lpstrFile, params->FileSought);
if(GetOpenFileNameW(&ofn))
{
WCHAR* last_slash = strrchrW(ofn.lpstrFile, '\\');
WCHAR* last_slash = wcsrchr(ofn.lpstrFile, '\\');
if (last_slash) *last_slash = 0;
SetDlgItemTextW(hwnd, IDC_PATH, ofn.lpstrFile);
}
......
......@@ -31,7 +31,6 @@
#include "winspool.h"
#include "setupapi.h"
#include "shlobj.h"
#include "wine/unicode.h"
#include "setupapi_private.h"
#include "wine/debug.h"
......@@ -61,10 +60,10 @@ static const WCHAR *get_unknown_dirid(void)
if (!unknown_dirid)
{
UINT len = GetSystemDirectoryW( NULL, 0 ) + strlenW(unknown_str);
UINT len = GetSystemDirectoryW( NULL, 0 ) + lstrlenW(unknown_str);
if (!(unknown_dirid = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) ))) return NULL;
GetSystemDirectoryW( unknown_dirid, len );
strcatW( unknown_dirid, unknown_str );
lstrcatW( unknown_dirid, unknown_str );
}
return unknown_dirid;
}
......@@ -101,23 +100,23 @@ static const WCHAR *create_system_dirid( int dirid )
break;
case DIRID_DRIVERS:
GetSystemDirectoryW( buffer, MAX_PATH );
strcatW( buffer, Drivers );
lstrcatW( buffer, Drivers );
break;
case DIRID_INF:
GetWindowsDirectoryW( buffer, MAX_PATH );
strcatW( buffer, Inf );
lstrcatW( buffer, Inf );
break;
case DIRID_HELP:
GetWindowsDirectoryW( buffer, MAX_PATH );
strcatW( buffer, Help );
lstrcatW( buffer, Help );
break;
case DIRID_FONTS:
GetWindowsDirectoryW( buffer, MAX_PATH );
strcatW( buffer, Fonts );
lstrcatW( buffer, Fonts );
break;
case DIRID_VIEWERS:
GetSystemDirectoryW( buffer, MAX_PATH );
strcatW( buffer, Viewers );
lstrcatW( buffer, Viewers );
break;
case DIRID_APPS:
return C_Root; /* FIXME */
......@@ -128,12 +127,12 @@ static const WCHAR *create_system_dirid( int dirid )
return C_Root; /* FIXME */
case DIRID_SYSTEM16:
GetWindowsDirectoryW( buffer, MAX_PATH );
strcatW( buffer, System );
lstrcatW( buffer, System );
break;
case DIRID_SPOOL:
case DIRID_SPOOLDRIVERS: /* FIXME */
GetWindowsDirectoryW( buffer, MAX_PATH );
strcatW( buffer, Spool );
lstrcatW( buffer, Spool );
break;
case DIRID_USERPROFILE:
if (GetEnvironmentVariableW( UserProfile, buffer, MAX_PATH )) break;
......@@ -152,7 +151,7 @@ static const WCHAR *create_system_dirid( int dirid )
FIXME( "unknown dirid %d\n", dirid );
return get_unknown_dirid();
}
len = (strlenW(buffer) + 1) * sizeof(WCHAR);
len = (lstrlenW(buffer) + 1) * sizeof(WCHAR);
if ((str = HeapAlloc( GetProcessHeap(), 0, len ))) memcpy( str, buffer, len );
return str;
}
......@@ -167,7 +166,7 @@ static const WCHAR *get_csidl_dir( DWORD csidl )
FIXME( "CSIDL %x not found\n", csidl );
return get_unknown_dirid();
}
len = (strlenW(buffer) + 1) * sizeof(WCHAR);
len = (lstrlenW(buffer) + 1) * sizeof(WCHAR);
if ((str = HeapAlloc( GetProcessHeap(), 0, len ))) memcpy( str, buffer, len );
return str;
}
......@@ -288,7 +287,7 @@ BOOL WINAPI SetupSetDirectoryIdW( HINF hinf, DWORD id, PCWSTR dir )
}
/* duplicate the string */
len = (strlenW(dir)+1) * sizeof(WCHAR);
len = (lstrlenW(dir)+1) * sizeof(WCHAR);
if (!(str = HeapAlloc( GetProcessHeap(), 0, len ))) return FALSE;
memcpy( str, dir, len );
return store_user_dirid( hinf, id, str );
......
......@@ -192,7 +192,7 @@ BOOL WINAPI SetupQuerySpaceRequiredOnDriveW(HDSKSPC DiskSpace,
for (i = 0; i < list->dwDriveCount; i++)
{
TRACE("checking drive %s\n",debugstr_w(list->Drives[i].lpzName));
if (lstrcmpW(driveW,list->Drives[i].lpzName)==0)
if (wcscmp(driveW,list->Drives[i].lpzName)==0)
{
rc = TRUE;
*SpaceRequired = list->Drives[i].dwWantedSpace;
......
......@@ -32,7 +32,6 @@
#include "mscat.h"
#include "shlobj.h"
#include "wine/unicode.h"
#include "wine/debug.h"
#include "setupapi_private.h"
......@@ -139,7 +138,7 @@ LPWSTR WINAPI DuplicateString(LPCWSTR lpSrc)
if (lpDst == NULL)
return NULL;
strcpyW(lpDst, lpSrc);
lstrcpyW(lpDst, lpSrc);
return lpDst;
}
......@@ -920,14 +919,14 @@ static BOOL find_existing_inf(const WCHAR *source, WCHAR *target)
}
GetWindowsDirectoryW( target, MAX_PATH );
strcatW( target, infW );
strcatW( target, wildcardW );
lstrcatW( target, infW );
lstrcatW( target, wildcardW );
if ((find_handle = FindFirstFileW( target, &find_data )) != INVALID_HANDLE_VALUE)
{
do {
GetWindowsDirectoryW( target, MAX_PATH );
strcatW( target, infW );
strcatW( target, find_data.cFileName );
lstrcatW( target, infW );
lstrcatW( target, find_data.cFileName );
dest_file = CreateFileW( target, FILE_READ_DATA | FILE_READ_ATTRIBUTES,
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
NULL, OPEN_EXISTING, 0, NULL );
......@@ -999,8 +998,8 @@ BOOL WINAPI SetupCopyOEMInfW( PCWSTR source, PCWSTR location,
}
GetWindowsDirectoryW( target, ARRAY_SIZE(target) );
strcatW( target, inf );
strcatW( target, strrchrW( source, '\\' ) + 1 );
lstrcatW( target, inf );
lstrcatW( target, wcsrchr( source, '\\' ) + 1 );
if (GetFileAttributesW( target ) != INVALID_FILE_ATTRIBUTES)
{
for (i = 0; i < OEM_INDEX_LIMIT; i++)
......@@ -1008,8 +1007,8 @@ BOOL WINAPI SetupCopyOEMInfW( PCWSTR source, PCWSTR location,
static const WCHAR formatW[] = {'o','e','m','%','u','.','i','n','f',0};
GetWindowsDirectoryW( target, ARRAY_SIZE(target) );
strcatW( target, inf );
sprintfW( target + strlenW(target), formatW, i );
lstrcatW( target, inf );
swprintf( target + lstrlenW(target), ARRAY_SIZE(target) - lstrlenW(target), formatW, i );
if (GetFileAttributesW( target ) == INVALID_FILE_ATTRIBUTES)
break;
......@@ -1034,11 +1033,11 @@ BOOL WINAPI SetupCopyOEMInfW( PCWSTR source, PCWSTR location,
SetupCloseInfFile( hinf );
strcpyW( source_cat, source );
p = strrchrW( source_cat, '\\' );
lstrcpyW( source_cat, source );
p = wcsrchr( source_cat, '\\' );
if (p) p++;
else p = source_cat;
strcpyW( p, catalog_file );
lstrcpyW( p, catalog_file );
TRACE("installing catalog file %s\n", debugstr_w( source_cat ));
......@@ -1068,12 +1067,12 @@ done:
if (style & SP_COPY_DELETESOURCE)
DeleteFileW( source );
size = strlenW( target ) + 1;
size = lstrlenW( target ) + 1;
if (dest)
{
if (buffer_size >= size)
{
strcpyW( dest, target );
lstrcpyW( dest, target );
}
else
{
......@@ -1082,7 +1081,7 @@ done:
}
}
if (filepart) *filepart = strrchrW( target, '\\' ) + 1;
if (filepart) *filepart = wcsrchr( target, '\\' ) + 1;
if (required_size) *required_size = size;
if (ret) SetLastError(ERROR_SUCCESS);
......@@ -1123,8 +1122,8 @@ BOOL WINAPI SetupUninstallOEMInfW( PCWSTR inf_file, DWORD flags, PVOID reserved
if (!GetWindowsDirectoryW( target, ARRAY_SIZE( target ))) return FALSE;
strcatW( target, infW );
strcatW( target, inf_file );
lstrcatW( target, infW );
lstrcatW( target, inf_file );
if (flags & SUOI_FORCEDELETE)
return DeleteFileW(target);
......@@ -1511,7 +1510,7 @@ static UINT CALLBACK decompress_or_copy_callback( PVOID context, UINT notificati
TRACE("Requesting extraction of cabinet file %s\n",
wine_dbgstr_w(info->NameInCabinet));
strcpyW( info->FullTargetName, context_info->target );
lstrcpyW( info->FullTargetName, context_info->target );
context_info->has_extracted = TRUE;
return FILEOP_DOIT;
}
......
......@@ -19,6 +19,7 @@
*/
#include <stdarg.h>
#include <stdlib.h>
#include "windef.h"
#include "winbase.h"
......@@ -28,7 +29,6 @@
#include "advpub.h"
#include "winnls.h"
#include "wine/debug.h"
#include "wine/unicode.h"
#include "setupapi_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(setupapi);
......@@ -408,7 +408,7 @@ BOOL WINAPI SetupGetSourceFileLocationW( HINF hinf, PINFCONTEXT context, PCWSTR
if (!(source_id_str = get_source_id( hinf, context, filename )))
return FALSE;
*source_id = strtolW( source_id_str, &end, 10 );
*source_id = wcstol( source_id_str, &end, 10 );
if (end == source_id_str || *end)
{
HeapFree( GetProcessHeap(), 0, source_id_str );
......@@ -491,7 +491,7 @@ BOOL WINAPI SetupGetSourceInfoW( HINF hinf, UINT source_id, UINT info,
TRACE("%p, %d, %d, %p, %d, %p\n", hinf, source_id, info, buffer, buffer_size,
required_size);
sprintfW( source_id_str, fmt, source_id );
swprintf( source_id_str, ARRAY_SIZE(source_id_str), fmt, source_id );
if (!SetupFindFirstLineW( hinf, source_disks_names_platform, source_id_str, &ctx ) &&
!SetupFindFirstLineW( hinf, source_disks_names, source_id_str, &ctx ))
......@@ -602,7 +602,7 @@ BOOL WINAPI SetupGetTargetPathW( HINF hinf, PINFCONTEXT context, PCWSTR section,
GetSystemDirectoryW( systemdir, MAX_PATH );
dir = systemdir;
}
size = strlenW( dir ) + 1;
size = lstrlenW( dir ) + 1;
if (required_size) *required_size = size;
if (buffer)
......@@ -699,11 +699,11 @@ BOOL WINAPI SetupQueryInfOriginalFileInformationW(
* destination (copied) inf file, not the source (original) inf file.
* to fix it properly would require building a .pnf file */
/* file name is stored in VersionData field of InfInformation */
inf_name = strrchrW(inf_path, '\\');
inf_name = wcsrchr(inf_path, '\\');
if (inf_name) inf_name++;
else inf_name = inf_path;
strcpyW(OriginalFileInfo->OriginalInfName, inf_name);
lstrcpyW(OriginalFileInfo->OriginalInfName, inf_name);
return TRUE;
}
......@@ -36,7 +36,6 @@
#include "setupapi.h"
#include "setupapi_private.h"
#include "fdi.h"
#include "wine/unicode.h"
#include "wine/debug.h"
/* from msvcrt */
......@@ -462,7 +461,7 @@ static INT_PTR CDECL sc_FNNOTIFY_W(FDINOTIFICATIONTYPE fdint, PFDINOTIFICATION p
if (err == FILEOP_DOIT) {
TRACE(" Callback specified filename: %s\n", debugstr_w(fici.FullTargetName));
if (fici.FullTargetName[0]) {
len = strlenW(fici.FullTargetName) + 1;
len = lstrlenW(fici.FullTargetName) + 1;
if ((len > MAX_PATH ) || (len <= 1))
return 0;
if (!WideCharToMultiByte(CP_ACP, 0, fici.FullTargetName, len, charbuf, MAX_PATH, 0, 0))
......@@ -472,7 +471,7 @@ static INT_PTR CDECL sc_FNNOTIFY_W(FDINOTIFICATIONTYPE fdint, PFDINOTIFICATION p
SetLastError(ERROR_PATH_NOT_FOUND);
return -1;
}
strcpyW( phsc->most_recent_target, fici.FullTargetName );
lstrcpyW( phsc->most_recent_target, fici.FullTargetName );
return sc_cb_open(charbuf, _O_BINARY | _O_CREAT | _O_WRONLY, _S_IREAD | _S_IWRITE);
} else {
TRACE(" Callback skipped file.\n");
......@@ -525,7 +524,7 @@ static INT_PTR CDECL sc_FNNOTIFY_W(FDINOTIFICATIONTYPE fdint, PFDINOTIFICATION p
return -1;
} else {
if (mysterio[0]) {
len = strlenW(mysterio) + 1;
len = lstrlenW(mysterio) + 1;
if ((len > 255) || (len <= 1))
return 0;
if (!WideCharToMultiByte(CP_ACP, 0, mysterio, len, pfdin->psz3, 255, 0, 0))
......@@ -637,13 +636,13 @@ BOOL WINAPI SetupIterateCabinetW(PCWSTR CabinetFile, DWORD Reserved,
}
if (p) {
strcpyW(my_hsc.most_recent_cabinet_name, p);
lstrcpyW(my_hsc.most_recent_cabinet_name, p);
*p = 0;
len = WideCharToMultiByte(CP_ACP, 0, pszCabPathW, -1, pszCabPath,
MAX_PATH, 0, 0);
if (!len) return FALSE;
} else {
strcpyW(my_hsc.most_recent_cabinet_name, CabinetFile);
lstrcpyW(my_hsc.most_recent_cabinet_name, CabinetFile);
pszCabPath[0] = '\0';
}
......
......@@ -19,8 +19,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "config.h"
#include <stdarg.h>
#include "windef.h"
......@@ -31,7 +29,6 @@
#include "setupapi.h"
#include "wine/debug.h"
#include "wine/unicode.h"
WINE_DEFAULT_DEBUG_CHANNEL(setupapi);
......@@ -80,7 +77,7 @@ static inline DWORD get_string_hash(const WCHAR *str, BOOL case_sensitive)
DWORD hash = 0;
while (*str) {
WCHAR ch = case_sensitive ? *str : tolowerW(*str);
WCHAR ch = case_sensitive ? *str : towlower(*str);
hash += ch;
if (ch & ~0xff)
hash |= 1;
......@@ -105,7 +102,7 @@ static inline char *get_extradata_ptr(struct stringtable *table, DWORD id)
{
WCHAR *ptrW = get_string_ptr(table, id);
/* skip string itself */
return (char*)(ptrW + strlenW(ptrW) + 1);
return (char*)(ptrW + lstrlenW(ptrW) + 1);
}
static inline BOOL is_valid_string_id(struct stringtable *table, DWORD id)
......@@ -317,7 +314,7 @@ DWORD WINAPI StringTableLookUpStringEx(HSTRING_TABLE hTable, LPWSTR string, DWOR
while (1) {
entry = (struct stringentry*)(table->data + offset);
if (case_sensitive)
cmp = lstrcmpW(entry->data, string);
cmp = wcscmp(entry->data, string);
else
cmp = lstrcmpiW(entry->data, string);
if (!cmp) {
......@@ -398,7 +395,7 @@ DWORD WINAPI StringTableAddStringEx(HSTRING_TABLE hTable, LPWSTR string,
return id;
/* needed space for new record */
len = sizeof(DWORD) + (strlenW(string)+1)*sizeof(WCHAR) + table->max_extra_size;
len = sizeof(DWORD) + (lstrlenW(string)+1)*sizeof(WCHAR) + table->max_extra_size;
if (table->nextoffset + len >= table->allocated) {
table->allocated <<= 1;
table->data = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, table->data, table->allocated);
......@@ -422,9 +419,9 @@ DWORD WINAPI StringTableAddStringEx(HSTRING_TABLE hTable, LPWSTR string,
/* copy string */
ptrW = get_string_ptr(table, id);
strcpyW(ptrW, string);
lstrcpyW(ptrW, string);
if (!case_sensitive)
strlwrW(ptrW);
wcslwr(ptrW);
/* copy extra data */
if (extra)
......@@ -565,9 +562,9 @@ BOOL WINAPI StringTableStringFromIdEx(HSTRING_TABLE hTable, ULONG id, LPWSTR buf
}
ptrW = get_string_ptr(table, id);
len = (strlenW(ptrW) + 1)*sizeof(WCHAR);
len = (lstrlenW(ptrW) + 1)*sizeof(WCHAR);
if (len <= *buflen)
strcpyW(buff, ptrW);
lstrcpyW(buff, ptrW);
else
ret = FALSE;
......
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