Commit eea358e6 authored by Alex Henrie's avatar Alex Henrie Committed by Alexandre Julliard

setupapi/tests: Use CRT allocation functions.

parent bb6bcaf8
...@@ -33,7 +33,6 @@ ...@@ -33,7 +33,6 @@
#include "cfgmgr32.h" #include "cfgmgr32.h"
#include "cguid.h" #include "cguid.h"
#include "wine/heap.h"
#include "wine/test.h" #include "wine/test.h"
/* This is a unique guid for testing purposes */ /* This is a unique guid for testing purposes */
...@@ -1233,7 +1232,7 @@ static void test_device_iface_detail(void) ...@@ -1233,7 +1232,7 @@ static void test_device_iface_detail(void)
expected_size = FIELD_OFFSET(SP_DEVICE_INTERFACE_DETAIL_DATA_A, DevicePath[strlen(path) + 1]); expected_size = FIELD_OFFSET(SP_DEVICE_INTERFACE_DETAIL_DATA_A, DevicePath[strlen(path) + 1]);
ok(size == expected_size, "Expected size %lu, got %lu.\n", expected_size, size); ok(size == expected_size, "Expected size %lu, got %lu.\n", expected_size, size);
detail = heap_alloc(size * 2); detail = malloc(size * 2);
detail->cbSize = 0; detail->cbSize = 0;
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
...@@ -1283,7 +1282,7 @@ static void test_device_iface_detail(void) ...@@ -1283,7 +1282,7 @@ static void test_device_iface_detail(void)
ok(size == expected_size, "Expected size %lu, got %lu.\n", expected_size, size); ok(size == expected_size, "Expected size %lu, got %lu.\n", expected_size, size);
ok(IsEqualGUID(&device.ClassGuid, &guid), "Got unexpected class %s.\n", wine_dbgstr_guid(&device.ClassGuid)); ok(IsEqualGUID(&device.ClassGuid, &guid), "Got unexpected class %s.\n", wine_dbgstr_guid(&device.ClassGuid));
heap_free(detail); free(detail);
SetupDiDestroyDeviceInfoList(set); SetupDiDestroyDeviceInfoList(set);
} }
......
...@@ -207,17 +207,17 @@ static BOOL CDECL get_temp_file(char *pszTempName, int cbTempName, void *pv) ...@@ -207,17 +207,17 @@ static BOOL CDECL get_temp_file(char *pszTempName, int cbTempName, void *pv)
{ {
LPSTR tempname; LPSTR tempname;
tempname = HeapAlloc(GetProcessHeap(), 0, MAX_PATH); tempname = malloc(MAX_PATH);
GetTempFileNameA(".", "xx", 0, tempname); GetTempFileNameA(".", "xx", 0, tempname);
if (tempname && (strlen(tempname) < (unsigned)cbTempName)) if (tempname && (strlen(tempname) < (unsigned)cbTempName))
{ {
lstrcpyA(pszTempName, tempname); lstrcpyA(pszTempName, tempname);
HeapFree(GetProcessHeap(), 0, tempname); free(tempname);
return TRUE; return TRUE;
} }
HeapFree(GetProcessHeap(), 0, tempname); free(tempname);
return FALSE; return FALSE;
} }
......
...@@ -109,7 +109,7 @@ static void test_original_file_name(LPCSTR original, LPCSTR dest) ...@@ -109,7 +109,7 @@ static void test_original_file_name(LPCSTR original, LPCSTR dest)
res = SetupGetInfInformationA(hinf, INFINFO_INF_SPEC_IS_HINF, NULL, 0, &size); res = SetupGetInfInformationA(hinf, INFINFO_INF_SPEC_IS_HINF, NULL, 0, &size);
ok(res, "SetupGetInfInformation failed with error %ld\n", GetLastError()); ok(res, "SetupGetInfInformation failed with error %ld\n", GetLastError());
pspii = HeapAlloc(GetProcessHeap(), 0, size); pspii = malloc(size);
res = SetupGetInfInformationA(hinf, INFINFO_INF_SPEC_IS_HINF, pspii, size, NULL); res = SetupGetInfInformationA(hinf, INFINFO_INF_SPEC_IS_HINF, pspii, size, NULL);
ok(res, "SetupGetInfInformation failed with error %ld\n", GetLastError()); ok(res, "SetupGetInfInformation failed with error %ld\n", GetLastError());
...@@ -125,7 +125,7 @@ static void test_original_file_name(LPCSTR original, LPCSTR dest) ...@@ -125,7 +125,7 @@ static void test_original_file_name(LPCSTR original, LPCSTR dest)
ok(!spofi.OriginalCatalogName[0], "spofi.OriginalCatalogName should have been \"\" instead of \"%s\"\n", spofi.OriginalCatalogName); ok(!spofi.OriginalCatalogName[0], "spofi.OriginalCatalogName should have been \"\" instead of \"%s\"\n", spofi.OriginalCatalogName);
ok(!strcmp(original, spofi.OriginalInfName), "spofi.OriginalInfName of %s didn't match real original name %s\n", spofi.OriginalInfName, original); ok(!strcmp(original, spofi.OriginalInfName), "spofi.OriginalInfName of %s didn't match real original name %s\n", spofi.OriginalInfName, original);
HeapFree(GetProcessHeap(), 0, pspii); free(pspii);
SetupCloseInfFile(hinf); SetupCloseInfFile(hinf);
} }
...@@ -371,12 +371,12 @@ static BOOL compare_file_data(LPSTR file, const BYTE *data, DWORD size) ...@@ -371,12 +371,12 @@ static BOOL compare_file_data(LPSTR file, const BYTE *data, DWORD size)
LPBYTE buffer; LPBYTE buffer;
handle = CreateFileA(file, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); handle = CreateFileA(file, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
buffer = HeapAlloc(GetProcessHeap(), 0, size); buffer = malloc(size);
if (buffer) if (buffer)
{ {
ReadFile(handle, buffer, size, &read, NULL); ReadFile(handle, buffer, size, &read, NULL);
if (read == size && !memcmp(data, buffer, size)) ret = TRUE; if (read == size && !memcmp(data, buffer, size)) ret = TRUE;
HeapFree(GetProcessHeap(), 0, buffer); free(buffer);
} }
CloseHandle(handle); CloseHandle(handle);
return ret; return ret;
......
...@@ -120,7 +120,7 @@ static BOOL check_info_filename(PSP_INF_INFORMATION info, LPSTR test) ...@@ -120,7 +120,7 @@ static BOOL check_info_filename(PSP_INF_INFORMATION info, LPSTR test)
if (!SetupQueryInfFileInformationA(info, 0, NULL, 0, &size)) if (!SetupQueryInfFileInformationA(info, 0, NULL, 0, &size))
return FALSE; return FALSE;
filename = HeapAlloc(GetProcessHeap(), 0, size); filename = malloc(size);
if (!filename) if (!filename)
return FALSE; return FALSE;
...@@ -129,7 +129,7 @@ static BOOL check_info_filename(PSP_INF_INFORMATION info, LPSTR test) ...@@ -129,7 +129,7 @@ static BOOL check_info_filename(PSP_INF_INFORMATION info, LPSTR test)
if (!lstrcmpiA(test, filename)) if (!lstrcmpiA(test, filename))
ret = TRUE; ret = TRUE;
HeapFree(GetProcessHeap(), 0, filename); free(filename);
return ret; return ret;
} }
...@@ -142,7 +142,7 @@ static PSP_INF_INFORMATION alloc_inf_info(LPCSTR filename, DWORD search, PDWORD ...@@ -142,7 +142,7 @@ static PSP_INF_INFORMATION alloc_inf_info(LPCSTR filename, DWORD search, PDWORD
if (!ret) if (!ret)
return NULL; return NULL;
info = HeapAlloc(GetProcessHeap(), 0, *size); info = malloc(*size);
return info; return info;
} }
...@@ -234,7 +234,7 @@ static void test_SetupGetInfInformation(void) ...@@ -234,7 +234,7 @@ static void test_SetupGetInfInformation(void)
ret = SetupGetInfInformationA(inf_filename, INFINFO_INF_NAME_IS_ABSOLUTE, NULL, size, NULL); ret = SetupGetInfInformationA(inf_filename, INFINFO_INF_NAME_IS_ABSOLUTE, NULL, size, NULL);
ok(ret == FALSE, "Expected SetupGetInfInformation to fail\n"); ok(ret == FALSE, "Expected SetupGetInfInformation to fail\n");
info = HeapAlloc(GetProcessHeap(), 0, size); info = malloc(size);
/* try valid ReturnBuffer but too small size */ /* try valid ReturnBuffer but too small size */
SetLastError(0xbeefcafe); SetLastError(0xbeefcafe);
...@@ -248,7 +248,7 @@ static void test_SetupGetInfInformation(void) ...@@ -248,7 +248,7 @@ static void test_SetupGetInfInformation(void)
ok(ret == TRUE, "Expected SetupGetInfInformation to succeed\n"); ok(ret == TRUE, "Expected SetupGetInfInformation to succeed\n");
ok(check_info_filename(info, inf_filename), "Expected returned filename to be equal\n"); ok(check_info_filename(info, inf_filename), "Expected returned filename to be equal\n");
HeapFree(GetProcessHeap(), 0, info); free(info);
/* try the INFINFO_INF_SPEC_IS_HINF search flag */ /* try the INFINFO_INF_SPEC_IS_HINF search flag */
hinf = SetupOpenInfFileA(inf_filename, NULL, INF_STYLE_WIN4, NULL); hinf = SetupOpenInfFileA(inf_filename, NULL, INF_STYLE_WIN4, NULL);
...@@ -269,7 +269,7 @@ static void test_SetupGetInfInformation(void) ...@@ -269,7 +269,7 @@ static void test_SetupGetInfInformation(void)
} }
ok(ret, "can't create inf file %lu\n", GetLastError()); ok(ret, "can't create inf file %lu\n", GetLastError());
HeapFree(GetProcessHeap(), 0, info); free(info);
info = alloc_inf_info("test.inf", INFINFO_DEFAULT_SEARCH, &size); info = alloc_inf_info("test.inf", INFINFO_DEFAULT_SEARCH, &size);
/* check if system32 is searched for inf */ /* check if system32 is searched for inf */
...@@ -284,7 +284,7 @@ static void test_SetupGetInfInformation(void) ...@@ -284,7 +284,7 @@ static void test_SetupGetInfInformation(void)
lstrcatA(inf_one, "test.inf"); lstrcatA(inf_one, "test.inf");
create_inf_file(inf_one, inf_data1, sizeof(inf_data1) - 1); create_inf_file(inf_one, inf_data1, sizeof(inf_data1) - 1);
HeapFree(GetProcessHeap(), 0, info); free(info);
info = alloc_inf_info("test.inf", INFINFO_DEFAULT_SEARCH, &size); info = alloc_inf_info("test.inf", INFINFO_DEFAULT_SEARCH, &size);
/* test the INFINFO_DEFAULT_SEARCH search flag */ /* test the INFINFO_DEFAULT_SEARCH search flag */
...@@ -292,7 +292,7 @@ static void test_SetupGetInfInformation(void) ...@@ -292,7 +292,7 @@ static void test_SetupGetInfInformation(void)
ok(ret == TRUE, "Expected SetupGetInfInformation to succeed: %ld\n", GetLastError()); ok(ret == TRUE, "Expected SetupGetInfInformation to succeed: %ld\n", GetLastError());
ok(check_info_filename(info, inf_one), "Expected returned filename to be equal\n"); ok(check_info_filename(info, inf_one), "Expected returned filename to be equal\n");
HeapFree(GetProcessHeap(), 0, info); free(info);
info = alloc_inf_info("test.inf", INFINFO_REVERSE_DEFAULT_SEARCH, &size); info = alloc_inf_info("test.inf", INFINFO_REVERSE_DEFAULT_SEARCH, &size);
/* test the INFINFO_REVERSE_DEFAULT_SEARCH search flag */ /* test the INFINFO_REVERSE_DEFAULT_SEARCH search flag */
...@@ -301,7 +301,7 @@ static void test_SetupGetInfInformation(void) ...@@ -301,7 +301,7 @@ static void test_SetupGetInfInformation(void)
ok(check_info_filename(info, revfile), "Expected returned filename to be equal\n"); ok(check_info_filename(info, revfile), "Expected returned filename to be equal\n");
done: done:
HeapFree(GetProcessHeap(), 0, info); free(info);
DeleteFileA(inf_filename); DeleteFileA(inf_filename);
DeleteFileA(inf_one); DeleteFileA(inf_one);
DeleteFileA(inf_two); DeleteFileA(inf_two);
......
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