diff options
| author | Tannin <devnull@localhost> | 2015-01-04 10:33:37 +0100 |
|---|---|---|
| committer | Tannin <devnull@localhost> | 2015-01-04 10:33:37 +0100 |
| commit | b415db619ed027ec2acd283983624293274b090f (patch) | |
| tree | 3b09112799f2728229ed98bca7b342f1e8d1232a /src/shared/inject.cpp | |
| parent | bd8267993d1ed0292200f3052e3c30d4fc9c84f7 (diff) | |
| parent | b2d04d70fc6284797e1bf29f55a375cb59d012be (diff) | |
Merge
Diffstat (limited to 'src/shared/inject.cpp')
| -rw-r--r-- | src/shared/inject.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/shared/inject.cpp b/src/shared/inject.cpp index 5a111c4a..143652c2 100644 --- a/src/shared/inject.cpp +++ b/src/shared/inject.cpp @@ -57,13 +57,13 @@ void injectDLL(HANDLE processHandle, HANDLE threadHandle, const std::string &dll _snprintf(parameters.initstr, 5, "Init"); //this is the name of thie initialisation function we want to call in the target process
HMODULE k32mod = ::LoadLibrary(__TEXT("kernel32.dll"));
- TLoadLibraryType loadLibraryFunc = NULL;
- TGetProcAddressType getProcAddressFunc = NULL;
+ TLoadLibraryType loadLibraryFunc = nullptr;
+ TGetProcAddressType getProcAddressFunc = nullptr;
// ansi binaries
- if (k32mod != NULL) {
+ if (k32mod != nullptr) {
loadLibraryFunc = reinterpret_cast<TLoadLibraryType>(::GetProcAddress(k32mod, "LoadLibraryA"));
getProcAddressFunc = reinterpret_cast<TGetProcAddressType>(::GetProcAddress(k32mod, "GetProcAddress"));
- if ((loadLibraryFunc == NULL) || (getProcAddressFunc == NULL)) {
+ if ((loadLibraryFunc == nullptr) || (getProcAddressFunc == nullptr)) {
throw windows_error("failed to determine address for required functions");
}
} else {
@@ -71,8 +71,8 @@ void injectDLL(HANDLE processHandle, HANDLE threadHandle, const std::string &dll }
// allocate memory in the target process and write the parameter-block there
- LPVOID remoteMem = ::VirtualAllocEx(processHandle, NULL, sizeof(TParameters), MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE);
- if (remoteMem == NULL) {
+ LPVOID remoteMem = ::VirtualAllocEx(processHandle, nullptr, sizeof(TParameters), MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE);
+ if (remoteMem == nullptr) {
throw windows_error("failed to allocate memory in target process");
}
SIZE_T written;
@@ -104,8 +104,8 @@ void injectDLL(HANDLE processHandle, HANDLE threadHandle, const std::string &dll };
// reserve memory for the stub
- PBYTE stubRemote = reinterpret_cast<PBYTE>(::VirtualAllocEx(processHandle, NULL, sizeof(stubLocal), MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE));
- if (stubRemote == NULL) {
+ PBYTE stubRemote = reinterpret_cast<PBYTE>(::VirtualAllocEx(processHandle, nullptr, sizeof(stubLocal), MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE));
+ if (stubRemote == nullptr) {
throw windows_error("failed to allocate memory for stub");
}
TParameters *remoteParams = reinterpret_cast<TParameters*>(remoteMem);
|
