Hi everyone,
I apologise in advance if my question seems confusing & noobish but I have no clue about coding in C++ hence the apparent ignorance & difficulty to me (& for some it may be a very basic question). First of all I have these lines of code that I would like to amend slightly like so:
1 2 3 4 5 6 7 8 9 10
|
typedef DWORD(__stdcall *CPP) (DWORD param1, PWCHAR param2, DWORD param3);
void Disable_WFP() {
hmod=LoadLibrary("sfc_os.dll");
CPP SetSfcFileException;
// the function is stored at the fifth ordinal in sfc_os.dll
SetSfcFileException=(CPP)GetProcAddress(hmod,(LPCSTR)5);
SetSfcFileException(0, L"c:\\windows\\system32\\calc.exe",-1);
// Now we can modify the system file in a complete stealth.
}
|
I have been advised that the above code could be used to produce malware but as with all things A hammer can be used to drive nails in or a hammer can be used to drive nails through someones hand, the latter being used for negative effect.
The only reason I am saying this is to affirm I want to use the code to disable the WFP on Selective files to carry out removal of said files or amendmant NOT to write malware as someone on another forum accused me of.
What I would like to do is change this line in the example above:
SetSfcFileException(0, L"
c:\\windows\\system32\\calc.exe",-1);
I would like to change to something like this (Obviously this is not C++ code it is just for illustration purposes to show what I am trying to do:
SetSfcFileException(0, L"
%SystemDrive%\\windows\\system32\\calc.exe",-1);
interchanging %SystemDrive% for C:\\ So no matter what drive I wish to run the program it will be on the system drive & not hard coded to C:\\
The question is what would be the equivelent code in C++ for SystemDrive in the context or scenario above & if at all possible a way to use a second file coded to reverse the process or undo feature. I would use this code to disarm WFP on selective files so that they can be removed or amended for mini windowsXP systems not for other OS's
Can anyone help out please. I have found 2 snippets of code that might help but do not know how to combine them. The code is:
sysdrive = getenv("SYSTEMDRIVE");
if (sysdrive == NULL || *sysdrive == NUL)
sysdrive = "C:\\";
}
char *sysDrive = getenv ("SystemDrive");
Best Regards,
ispy