102 lines
4.5 KiB
Plaintext
102 lines
4.5 KiB
Plaintext
|
// This is some text code for the CorrectFilePathsUninstall shim.
|
||
|
|
||
|
#define TEST_CPC
|
||
|
|
||
|
// Add this in InitializeHooks():
|
||
|
void InitializeHooks(DWORD fdwReason)
|
||
|
{
|
||
|
if (fdwReason == DLL_PROCESS_ATTACH)
|
||
|
{
|
||
|
#ifdef TEST_CPC
|
||
|
TestCPC();
|
||
|
#endif
|
||
|
INIT_HOOKS(APIHOOK_Count);
|
||
|
|
||
|
|
||
|
#ifdef TEST_CPC
|
||
|
|
||
|
#include "CorrectPathChanges.h"
|
||
|
|
||
|
void TestPath(CorrectPathChangesBase & cpc, CorrectPathChangesBase & cpcu, CorrectPathChangesBase & cpca, CorrectPathChangesBase & cpcfu, const char * old)
|
||
|
{
|
||
|
char * strCorrectFile = CorrectPathAllocA(old);
|
||
|
char * strCorrectFilecpc = cpc.CorrectPathAllocA(old);
|
||
|
char * strCorrectFilecpcu = cpcu.CorrectPathAllocA(old);
|
||
|
char * strCorrectFilecpca = cpca.CorrectPathAllocA(old);
|
||
|
char * strCorrectFilecpcfu= cpcfu.CorrectPathAllocA(old);
|
||
|
|
||
|
DPF(eDbgLevelInfo, "Test CPC(%s)\n", old);
|
||
|
DPF(eDbgLevelInfo, "Base class CPC(%s)\n", strCorrectFilecpc);
|
||
|
DPF(eDbgLevelInfo, "orig CPC(%s)\n", strCorrectFile);
|
||
|
DPF(eDbgLevelInfo, "AllU class CPC(%s)\n", strCorrectFilecpca);
|
||
|
DPF(eDbgLevelInfo, "FUser class CPC(%s)\n\n", strCorrectFilecpcfu);
|
||
|
|
||
|
free(strCorrectFile);
|
||
|
free(strCorrectFilecpc);
|
||
|
free(strCorrectFilecpcu);
|
||
|
free(strCorrectFilecpca);
|
||
|
free(strCorrectFilecpcfu);
|
||
|
}
|
||
|
|
||
|
void TestCPC()
|
||
|
{
|
||
|
CorrectPathChangesBase cpc;
|
||
|
CorrectPathChangesUser cpcu;
|
||
|
CorrectPathChangesAllUser cpca;
|
||
|
CorrectPathChangesForceUser cpcfu;
|
||
|
|
||
|
cpc.AddCommandLineA( "abc;abcd" );
|
||
|
TestPath(cpc, cpc, cpc, cpc, "abcdefg abc abcd");
|
||
|
|
||
|
cpc.AddCommandLineA( NULL);
|
||
|
cpc.AddCommandLineA( "" );
|
||
|
cpc.AddCommandLineA( ";" );
|
||
|
cpc.AddCommandLineA( "\"" );
|
||
|
cpc.AddCommandLineA( "\"\":" );
|
||
|
cpc.AddCommandLineA( "a;" );
|
||
|
cpc.AddCommandLineA( "a;b" );
|
||
|
cpc.AddCommandLineA( "a\";" );
|
||
|
cpc.AddCommandLineA( "a\";" );
|
||
|
|
||
|
|
||
|
TestPath(cpc, cpcu, cpca, cpcfu, "abcdefg abc abcd");
|
||
|
TestPath(cpc, cpcu, cpca, cpcfu, NULL);
|
||
|
TestPath(cpc, cpcu, cpca, cpcfu, "");
|
||
|
TestPath(cpc, cpcu, cpca, cpcfu, "c:\\windows");
|
||
|
TestPath(cpc, cpcu, cpca, cpcfu, "c:\\program files");
|
||
|
TestPath(cpc, cpcu, cpca, cpcfu, "d:\\winnt\\rundll32.exe");
|
||
|
TestPath(cpc, cpcu, cpca, cpcfu, "d:\\winnt\\write.exe");
|
||
|
TestPath(cpc, cpcu, cpca, cpcfu, "d:\\winnt\\wordpad.exe");
|
||
|
TestPath(cpc, cpcu, cpca, cpcfu, "d:\\program files\\Accessories\\wordpad.exe");
|
||
|
TestPath(cpc, cpcu, cpca, cpcfu, "d:\\winnt\\Start Menu");
|
||
|
TestPath(cpc, cpcu, cpca, cpcfu, "d:\\winnt\\Desktop");
|
||
|
TestPath(cpc, cpcu, cpca, cpcfu, "d:\\winnt\\Favorites");
|
||
|
TestPath(cpc, cpcu, cpca, cpcfu, "d:\\winnt\\Profiles\\robkenny\\Start Menu");
|
||
|
TestPath(cpc, cpcu, cpca, cpcfu, "d:\\winnt\\Profiles\\robkenny\\Desktop");
|
||
|
TestPath(cpc, cpcu, cpca, cpcfu, "d:\\winnt\\Profiles\\robkenny\\Favorites");
|
||
|
TestPath(cpc, cpcu, cpca, cpcfu, "d:\\winnt\\Profiles\\All Users\\Start Menu");
|
||
|
TestPath(cpc, cpcu, cpca, cpcfu, "d:\\winnt\\Profiles\\All Users\\Desktop");
|
||
|
TestPath(cpc, cpcu, cpca, cpcfu, "d:\\winnt\\Profiles\\All Users\\Favorites");
|
||
|
// Case sensitivity check
|
||
|
TestPath(cpc, cpcu, cpca, cpcfu, "c:\\winDOWS");
|
||
|
TestPath(cpc, cpcu, cpca, cpcfu, "c:\\proGRAM FILES");
|
||
|
TestPath(cpc, cpcu, cpca, cpcfu, "d:\\winNT\\RUNDLL32.EXE");
|
||
|
TestPath(cpc, cpcu, cpca, cpcfu, "d:\\winNT\\WRITE.EXE");
|
||
|
TestPath(cpc, cpcu, cpca, cpcfu, "d:\\winNT\\WORDPAD.EXE");
|
||
|
TestPath(cpc, cpcu, cpca, cpcfu, "d:\\proGRAM FILES\\ACCESSOries\\wordpad.exe");
|
||
|
TestPath(cpc, cpcu, cpca, cpcfu, "d:\\winNT\\START MENU");
|
||
|
TestPath(cpc, cpcu, cpca, cpcfu, "d:\\winNT\\DESKTOP");
|
||
|
TestPath(cpc, cpcu, cpca, cpcfu, "d:\\winNT\\FAVORITES");
|
||
|
TestPath(cpc, cpcu, cpca, cpcfu, "d:\\winNT\\PROFILES\\ROBKEnny\\Start Menu");
|
||
|
TestPath(cpc, cpcu, cpca, cpcfu, "d:\\winNT\\PROFILES\\ROBKEnny\\Desktop");
|
||
|
TestPath(cpc, cpcu, cpca, cpcfu, "d:\\winNT\\PROFILES\\ROBKEnny\\Favorites");
|
||
|
TestPath(cpc, cpcu, cpca, cpcfu, "d:\\winNT\\PROFILES\\ALL Users\\Start Menu");
|
||
|
TestPath(cpc, cpcu, cpca, cpcfu, "d:\\winNT\\PROFILES\\ALL Users\\Desktop");
|
||
|
TestPath(cpc, cpcu, cpca, cpcfu, "d:\\winNT\\PROFILES\\ALL Users\\Favorites");
|
||
|
// Multiple changes per line
|
||
|
TestPath(cpc, cpcu, cpca, cpcfu, "d:\\winNT\\PROFILES\\ALL Users\\Desktop Hi Mom! d:\\winnt\\Profiles\\robkenny\\Favorites Number 1!");
|
||
|
TestPath(cpc, cpcu, cpca, cpcfu, "c:\\windows c:\\windows c:\\windows c:\\windows c:\\windows c:\\windows c:\\windows ");
|
||
|
}
|
||
|
#endif
|
||
|
|