mirror of
https://github.com/microsoft/debugpy.git
synced 2025-12-23 08:48:12 +00:00
More compiler tweaks
This commit is contained in:
parent
c595b6f07c
commit
78bd26571e
14 changed files with 8 additions and 2 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -74,7 +74,8 @@ int wmain( int argc, wchar_t *argv[ ], wchar_t *envp[ ] )
|
|||
const int MAX_PATH_SIZE_PADDED = MAX_PATH + 1;
|
||||
char dllPath[MAX_PATH_SIZE_PADDED];
|
||||
memset(&dllPath[0], '\0', MAX_PATH_SIZE_PADDED);
|
||||
wcstombs(dllPath, argv[2], MAX_PATH);
|
||||
size_t pathLen = 0;
|
||||
wcstombs_s(&pathLen, dllPath, argv[2], MAX_PATH);
|
||||
|
||||
const bool inheritable = false;
|
||||
const HANDLE hProcess = OpenProcess(PROCESS_VM_OPERATION | PROCESS_CREATE_THREAD | PROCESS_VM_READ | PROCESS_VM_WRITE | PROCESS_QUERY_INFORMATION, inheritable, pid);
|
||||
|
|
@ -95,7 +96,7 @@ int wmain( int argc, wchar_t *argv[ ], wchar_t *envp[ ] )
|
|||
|
||||
std::cout << "VirtualAllocEx in pid: " << pid << std::endl;
|
||||
|
||||
const bool written = WriteProcessMemory(hProcess, remoteMemoryAddr, dllPath, MAX_PATH_SIZE_PADDED, nullptr);
|
||||
const bool written = WriteProcessMemory(hProcess, remoteMemoryAddr, dllPath, pathLen, nullptr);
|
||||
if(!written){
|
||||
std::cout << "Error. Unable to write to memory in pid: " << pid << ". Error code: " << GetLastError() << "." << std::endl;
|
||||
return 5;
|
||||
|
|
|
|||
|
|
@ -14,6 +14,10 @@ HINSTANCE globalDllInstance = NULL;
|
|||
|
||||
class NotificationHelper {
|
||||
public:
|
||||
#pragma warning( push )
|
||||
#pragma warning( disable : 4722 )
|
||||
// disable c4722 here: Destructor newver returns warning. Compiler sees ExitThread and assumes that
|
||||
// there is a potential memory leak.
|
||||
~NotificationHelper(){
|
||||
std::string eventName("_pydevd_pid_event_");
|
||||
eventName += std::to_string(GetCurrentProcessId());
|
||||
|
|
@ -27,6 +31,7 @@ public:
|
|||
}
|
||||
FreeLibraryAndExitThread(globalDllInstance, 0);
|
||||
}
|
||||
#pragma warning( pop )
|
||||
};
|
||||
|
||||
DWORD WINAPI RunCodeInThread(LPVOID lpParam){
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue