safe sprintfs

This commit is contained in:
Silent 2016-03-31 19:51:14 +02:00
parent 1c40c65c05
commit b64fb9b389
4 changed files with 9 additions and 9 deletions

View File

@ -50,7 +50,7 @@ void InjectHooks()
RECT desktop; RECT desktop;
GetWindowRect(GetDesktopWindow(), &desktop); GetWindowRect(GetDesktopWindow(), &desktop);
sprintf(aNoDesktopMode, "Cannot find %dx%dx32 video mode", desktop.right, desktop.bottom); sprintf_s(aNoDesktopMode, "Cannot find %dx%dx32 video mode", desktop.right, desktop.bottom);
if (*(DWORD*)0x5C1E75 == 0xB85548EC) if (*(DWORD*)0x5C1E75 == 0xB85548EC)
{ {

View File

@ -675,7 +675,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{ {
RECT desktop; RECT desktop;
GetWindowRect(GetDesktopWindow(), &desktop); GetWindowRect(GetDesktopWindow(), &desktop);
sprintf(aNoDesktopMode, "Cannot find %dx%dx32 video mode", desktop.right, desktop.bottom); sprintf_s(aNoDesktopMode, "Cannot find %dx%dx32 video mode", desktop.right, desktop.bottom);
if (*(DWORD*)0x5C1E75 == 0xB85548EC) Patch_III_10(desktop); if (*(DWORD*)0x5C1E75 == 0xB85548EC) Patch_III_10(desktop);
else if (*(DWORD*)0x5C2135 == 0xB85548EC) Patch_III_11(desktop); else if (*(DWORD*)0x5C2135 == 0xB85548EC) Patch_III_11(desktop);

View File

@ -2597,7 +2597,7 @@ void Patch_SA_10()
// Default resolution to native resolution // Default resolution to native resolution
RECT desktop; RECT desktop;
GetWindowRect(GetDesktopWindow(), &desktop); GetWindowRect(GetDesktopWindow(), &desktop);
_snprintf(aNoDesktopMode, sizeof(aNoDesktopMode), "Cannot find %dx%dx32 video mode", desktop.right, desktop.bottom); sprintf_s(aNoDesktopMode, "Cannot find %dx%dx32 video mode", desktop.right, desktop.bottom);
Patch<DWORD>(0x746363, desktop.right); Patch<DWORD>(0x746363, desktop.right);
Patch<DWORD>(0x746368, desktop.bottom); Patch<DWORD>(0x746368, desktop.bottom);
@ -2894,7 +2894,7 @@ void Patch_SA_11()
// Default resolution to native resolution // Default resolution to native resolution
RECT desktop; RECT desktop;
GetWindowRect(GetDesktopWindow(), &desktop); GetWindowRect(GetDesktopWindow(), &desktop);
_snprintf(aNoDesktopMode, sizeof(aNoDesktopMode), "Cannot find %dx%dx32 video mode", desktop.right, desktop.bottom); sprintf_s(aNoDesktopMode, "Cannot find %dx%dx32 video mode", desktop.right, desktop.bottom);
Patch<DWORD>(0x746BE3, desktop.right); Patch<DWORD>(0x746BE3, desktop.right);
Patch<DWORD>(0x746BE8, desktop.bottom); Patch<DWORD>(0x746BE8, desktop.bottom);
@ -3147,7 +3147,7 @@ void Patch_SA_Steam()
// Default resolution to native resolution // Default resolution to native resolution
RECT desktop; RECT desktop;
GetWindowRect(GetDesktopWindow(), &desktop); GetWindowRect(GetDesktopWindow(), &desktop);
_snprintf(aNoDesktopMode, sizeof(aNoDesktopMode), "Cannot find %dx%dx32 video mode", desktop.right, desktop.bottom); sprintf_s(aNoDesktopMode, "Cannot find %dx%dx32 video mode", desktop.right, desktop.bottom);
Patch<DWORD>(0x780219, desktop.right); Patch<DWORD>(0x780219, desktop.right);
Patch<DWORD>(0x78021E, desktop.bottom); Patch<DWORD>(0x78021E, desktop.bottom);
@ -3294,7 +3294,7 @@ void Patch_SA_NewSteam_r1()
// Default resolution to native resolution // Default resolution to native resolution
RECT desktop; RECT desktop;
GetWindowRect(GetDesktopWindow(), &desktop); GetWindowRect(GetDesktopWindow(), &desktop);
_snprintf(aNoDesktopMode, sizeof(aNoDesktopMode), "Cannot find %dx%dx32 video mode", desktop.right, desktop.bottom); sprintf_s(aNoDesktopMode, "Cannot find %dx%dx32 video mode", desktop.right, desktop.bottom);
Patch<DWORD>(0x77A3EF, desktop.right); Patch<DWORD>(0x77A3EF, desktop.right);
Patch<DWORD>(0x77A3F4, desktop.bottom); Patch<DWORD>(0x77A3F4, desktop.bottom);
@ -3351,7 +3351,7 @@ void Patch_SA_NewSteam_r2()
// Default resolution to native resolution // Default resolution to native resolution
RECT desktop; RECT desktop;
GetWindowRect(GetDesktopWindow(), &desktop); GetWindowRect(GetDesktopWindow(), &desktop);
_snprintf(aNoDesktopMode, sizeof(aNoDesktopMode), "Cannot find %dx%dx32 video mode", desktop.right, desktop.bottom); sprintf_s(aNoDesktopMode, "Cannot find %dx%dx32 video mode", desktop.right, desktop.bottom);
Patch<DWORD>(0x77A41F, desktop.right); Patch<DWORD>(0x77A41F, desktop.right);
Patch<DWORD>(0x77A424, desktop.bottom); Patch<DWORD>(0x77A424, desktop.bottom);
@ -3439,7 +3439,7 @@ void Patch_SA_NewSteam_r2_lv()
// Default resolution to native resolution // Default resolution to native resolution
RECT desktop; RECT desktop;
GetWindowRect(GetDesktopWindow(), &desktop); GetWindowRect(GetDesktopWindow(), &desktop);
_snprintf(aNoDesktopMode, sizeof(aNoDesktopMode), "Cannot find %dx%dx32 video mode", desktop.right, desktop.bottom); sprintf_s(aNoDesktopMode, "Cannot find %dx%dx32 video mode", desktop.right, desktop.bottom);
Patch<DWORD>(0x77A30F, desktop.right); Patch<DWORD>(0x77A30F, desktop.right);
Patch<DWORD>(0x77A314, desktop.bottom); Patch<DWORD>(0x77A314, desktop.bottom);

View File

@ -503,7 +503,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{ {
RECT desktop; RECT desktop;
GetWindowRect(GetDesktopWindow(), &desktop); GetWindowRect(GetDesktopWindow(), &desktop);
sprintf(aNoDesktopMode, "Cannot find %dx%dx32 video mode", desktop.right, desktop.bottom); sprintf_s(aNoDesktopMode, "Cannot find %dx%dx32 video mode", desktop.right, desktop.bottom);
if(*(DWORD*)0x667BF5 == 0xB85548EC) Patch_VC_10(desktop); if(*(DWORD*)0x667BF5 == 0xB85548EC) Patch_VC_10(desktop);
else if(*(DWORD*)0x667C45 == 0xB85548EC) Patch_VC_11(desktop); else if(*(DWORD*)0x667C45 == 0xB85548EC) Patch_VC_11(desktop);