WCHAR Outbuf[MAX_PATH];
DWORD i, MCL, Flags, Len;
- memset(Outbuf, 0xAA, MAX_PATH);
+ memset(Outbuf, 0xAA, sizeof(Outbuf));
Ret = GetVolumeInformationW(L"C:\\", NULL, 0, NULL, &MCL, &Flags, Outbuf, MAX_PATH);
ok(Ret != FALSE, "GetVolumeInformationW failed: %ld\n", GetLastError());
for (i = 0; i < MAX_PATH; ++i)
}
ok(i != MAX_PATH, "String was not null terminated!\n");
- memset(Outbuf, 0xAA, MAX_PATH);
+ memset(Outbuf, 0xAA, sizeof(Outbuf));
Len = i;
Ret = GetVolumeInformationW(L"C:\\", NULL, 0, NULL, &MCL, &Flags, Outbuf, Len + 1);
ok(Ret != FALSE, "GetVolumeInformationW failed: %ld\n", GetLastError());
ok(i != MAX_PATH, "String was not null terminated!\n");
ok(i == Len, "String was truncated\n");
- memset(Outbuf, 0xAA, MAX_PATH);
+ memset(Outbuf, 0xAA, sizeof(Outbuf));
Len = i;
SetLastError(0xdeadbeef);
Ret = GetVolumeInformationW(L"C:\\", NULL, 0, NULL, &MCL, &Flags, Outbuf, Len);
#include <winreg.h>
#include <winsvc.h>
#include <setupapi.h>
+#include <strsafe.h>
static const char inffile[] = "test.inf";
static char CURR_DIR[MAX_PATH];
/* [Version]:Signature */
strcpy(inf, "[Version]\nSignature=\"$Chicago$\"\n");
create_inf_file(inffile, inf);
- sprintf(path, "%s\\%s", CURR_DIR, inffile);
+ StringCbPrintfA(path, sizeof(path), "%s\\%s", CURR_DIR, inffile);
SetLastError(0xdeadbeef);
ret = SetupDiInstallClassExA(NULL, path, DI_QUIETINSTALL, NULL, NULL, NULL,NULL);
/* [Version]:Signature+Class */
strcat(inf, "Class=MySampleClass\n");
create_inf_file(inffile, inf);
- sprintf(path, "%s\\%s", CURR_DIR, inffile);
+ StringCbPrintfA(path, sizeof(path), "%s\\%s", CURR_DIR, inffile);
SetLastError(0xdeadbeef);
ret = SetupDiInstallClassExA(NULL, path, DI_QUIETINSTALL, NULL, NULL, NULL,NULL);
/* [Version]:Signature+Class+ClassGUID */
strcat(inf, "ClassGuid={3b409830-5f9d-432a-abf5-7d2e4e102467}\n");
create_inf_file(inffile, inf);
- sprintf(path, "%s\\%s", CURR_DIR, inffile);
+ StringCbPrintfA(path, sizeof(path), "%s\\%s", CURR_DIR, inffile);
SetLastError(0xdeadbeef);
ret = SetupDiInstallClassExA(NULL, path, DI_QUIETINSTALL, NULL, NULL, NULL,NULL);
/* [Version]Signature+Class+ClassGUID;[ClassInstall32.NT]Empty */
strcat(inf, "[ClassInstall32.NT]\n");
create_inf_file(inffile, inf);
- sprintf(path, "%s\\%s", CURR_DIR, inffile);
+ StringCbPrintfA(path, sizeof(path), "%s\\%s", CURR_DIR, inffile);
SetLastError(0xdeadbeef);
ret = SetupDiInstallClassExA(NULL, path, DI_QUIETINSTALL, NULL, NULL, NULL,NULL);
{
RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"SYSTEM", 0, KEY_ALL_ACCESS, &RegHandle);
del = RegDeleteKeyW(RegHandle, L"CurrentControlSet\\Control\\Class\\{3B409830-5F9D-432A-ABF5-7D2E4E102467}");
- ok(del == ERROR_SUCCESS, "Expected success \n");
+ ok(del == ERROR_SUCCESS, "Expected success \n");
}
/* [Version]Signature+Class+ClassGUID;[ClassInstall32.NT]AddReg */
strcat(inf, "AddReg=SampleClassAddReg\n");
create_inf_file(inffile, inf);
- sprintf(path, "%s\\%s", CURR_DIR, inffile);
+ StringCbPrintfA(path, sizeof(path), "%s\\%s", CURR_DIR, inffile);
SetLastError(0xdeadbeef);
ret = SetupDiInstallClassExA(NULL, path, DI_QUIETINSTALL, NULL, NULL, NULL,NULL);
{
RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"SYSTEM", 0, KEY_ALL_ACCESS, &RegHandle);
del = RegDeleteKeyW(RegHandle, L"CurrentControlSet\\Control\\Class\\{3B409830-5F9D-432A-ABF5-7D2E4E102467}");
- ok(del == ERROR_SUCCESS, "Expected success \n");
+ ok(del == ERROR_SUCCESS, "Expected success \n");
}
/* [Version]Signature+Class+ClassGUID;[ClassInstall32.NT]AddReg; [SampleClassAddReg];*/
strcat(inf, "[SampleClassAddReg]\n");
create_inf_file(inffile, inf);
- sprintf(path, "%s\\%s", CURR_DIR, inffile);
+ StringCbPrintfA(path, sizeof(path), "%s\\%s", CURR_DIR, inffile);
SetLastError(0xdeadbeef);
ret = SetupDiInstallClassExA(NULL, path, DI_QUIETINSTALL, NULL, NULL, NULL,NULL);
{
RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"SYSTEM", 0, KEY_ALL_ACCESS, &RegHandle);
del = RegDeleteKeyW(RegHandle, L"CurrentControlSet\\Control\\Class\\{3B409830-5F9D-432A-ABF5-7D2E4E102467}");
- ok(del == ERROR_SUCCESS, "Expected success \n");
+ ok(del == ERROR_SUCCESS, "Expected success \n");
}
/* [Version]Signature+Class+ClassGUID;[ClassInstall32.NT]AddReg; [SampleClassAddReg]HKR;*/
strcat(inf, "HKR,,,,\"ReactOS Test SetupDiInstallClassExA\"\n");
create_inf_file(inffile, inf);
- sprintf(path, "%s\\%s", CURR_DIR, inffile);
+ StringCbPrintfA(path, sizeof(path), "%s\\%s", CURR_DIR, inffile);
SetLastError(0xdeadbeef);
ret = SetupDiInstallClassExA(NULL, path, DI_QUIETINSTALL, NULL, NULL, NULL,NULL);
{
RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"SYSTEM", 0, KEY_ALL_ACCESS, &RegHandle);
del = RegDeleteKeyW(RegHandle, L"CurrentControlSet\\Control\\Class\\{3B409830-5F9D-432A-ABF5-7D2E4E102467}");
- ok(del == ERROR_SUCCESS, "Expected success \n");
+ ok(del == ERROR_SUCCESS, "Expected success \n");
}
/*[Version]Signature+Class+ClassGUID;[ClassInstall32.NT]AddReg;[SampleClassAddReg]HKR;[ClassInstall32.NT.Services]*/
strcat(inf, "[ClassInstall32.NT.Services]\n");
create_inf_file(inffile, inf);
- sprintf(path, "%s\\%s", CURR_DIR, inffile);
+ StringCbPrintfA(path, sizeof(path), "%s\\%s", CURR_DIR, inffile);
SetLastError(0xdeadbeef);
ret = SetupDiInstallClassExA(NULL, path, DI_QUIETINSTALL, NULL, NULL, NULL,NULL);
{
RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"SYSTEM", 0, KEY_ALL_ACCESS, &RegHandle);
del = RegDeleteKeyW(RegHandle, L"CurrentControlSet\\Control\\Class\\{3B409830-5F9D-432A-ABF5-7D2E4E102467}");
- ok(del == ERROR_SUCCESS, "Expected success\n");
+ ok(del == ERROR_SUCCESS, "Expected success\n");
}
/* Add a reference */
#include <winreg.h>
#include <winsvc.h>
#include <setupapi.h>
+#include <strsafe.h>
static const char inffile[] = "test.inf";
static char CURR_DIR[MAX_PATH];
/* Basic inf file to satisfy SetupOpenInfFileA */
strcpy(inf, "[Version]\nSignature=\"$Chicago$\"\n");
create_inf_file(inffile, inf);
- sprintf(path, "%s\\%s", CURR_DIR, inffile);
+ StringCbPrintfA(path, sizeof(path), "%s\\%s", CURR_DIR, inffile);
infhandle = SetupOpenInfFileA(path, NULL, INF_STYLE_WIN4, NULL);
/* Nothing but the Version section */
strcat(inf, "[XSP.InstallPerVer]\n");
strcat(inf, "AddReg=AspEventlogMsg.Reg,Perf.Reg,AspVersions.Reg,FreeADO.Reg,IndexServer.Reg\n");
create_inf_file(inffile, inf);
- sprintf(path, "%s\\%s", CURR_DIR, inffile);
+ StringCbPrintfA(path, sizeof(path), "%s\\%s", CURR_DIR, inffile);
infhandle = SetupOpenInfFileA(path, NULL, INF_STYLE_WIN4, NULL);
SetLastError(0xdeadbeef);
/* Basic inf file to satisfy SetupOpenInfFileA */
strcpy(inf, "[Version]\nSignature=\"$Chicago$\"\n");
create_inf_file(inffile, inf);
- sprintf(path, "%s\\%s", CURR_DIR, inffile);
+ StringCbPrintfA(path, sizeof(path), "%s\\%s", CURR_DIR, inffile);
infhandle = SetupOpenInfFileA(path, NULL, INF_STYLE_WIN4, NULL);
/* Nothing but the Version section */
strcat(inf, "[XSP.InstallPerVer]\n");
strcat(inf, "AddReg=AspEventlogMsg.Reg,Perf.Reg,AspVersions.Reg,FreeADO.Reg,IndexServer.Reg\n");
create_inf_file(inffile, inf);
- sprintf(path, "%s\\%s", CURR_DIR, inffile);
+ StringCbPrintfA(path, sizeof(path), "%s\\%s", CURR_DIR, inffile);
infhandle = SetupOpenInfFileA(path, NULL, INF_STYLE_WIN4, NULL);
SetLastError(0xdeadbeef);
START_TEST(SetupInstallServicesFromInfSectionEx)
{
- char temp_path[MAX_PATH], prev_path[MAX_PATH];
+ char temp_path[MAX_PATH], prev_path[MAX_PATH];
GetCurrentDirectoryA(MAX_PATH, prev_path);
GetTempPathA(MAX_PATH, temp_path);