CodePudding user response:
Fyi:
VOID Paint (HDC HDC) {
}
LRESULT a CALLBACK WndProc (HWND HWND, UINT message, WPARAM WPARAM, LPARAM LPARAM) {
In case the WM_PAINT:
HDC=BeginPaint (hWnd, & amp; Ps);
BitBlt (memDC, 0, 0, width, height, HDC, 0, 0, SRCCOPY);
Paint (memDC);
BitBlt (HDC, 0, 0, width, height, memDC, 0, 0, SRCCOPY);
EndPaint (hWnd, & amp; Ps);
return 0;
}
Global_hdc=GetDC (hWnd);
MemDC=CreateCompatibleDC (NULL);
HBITMAP BMP=CreateCompatibleBitmap (global_hdc, width, height);
HBITMAP OldBmp=(HBITMAP) SelectObject (memDC, BMP);
While (GetMessage (& amp; MSG, NULL, 0, 0)) {
TranslateMessage (& amp; MSG);
DispatchMessage (& amp; MSG);
}
SelectObject (global_hdc OldBmp);
DeleteObject (BMP);
DeleteDC (memDC);
ReleaseDC (hWnd, global_hdc);
CodePudding user response:
@ 4 teacher zhaoThe problem is that
1 HDC=BeginPaint (hWnd, & amp; Ps);
2 BitBlt (memDC, 0, 0, width, height, HDC, 0, 0, SRCCOPY);
3 Paint (memDC);
4 BitBlt (HDC, 0, 0, width, height, memDC, 0, 0, SRCCOPY);
5 EndPaint (hWnd, & amp; Ps);
In step 2, after the completion of MapX control in the Zoom command (Zoom), automatically to HDC map, and output to the window at the same time, rather than on the memDC drawing, I am hoping to replace MapX memDC DC
(both by mapxCtr GetDC () to obtain the CDC), know when drawing operation on MapX memDC, I at the end of the according to the drawing after message copy to the screen
CodePudding user response:
WinAPIOverride http://jacquelin.potier.free.fr/winapioverride32/CodePudding user response:
@ 4 teacher zhaoThank you for your enthusiastic help, WinAPIOverride see MapX would have been in the process of a scale to draw information, its DC (hereinafter referred to as DC_Map) process including GetDC - IsWindow ReleaseDC (), but there is no help, these information for my goal I was in the process of scaling can I create memDC to replace DC_Map so as to achieve the purpose of not flicker
CodePudding user response:
Use WinAPIOverride, Hook MapX GetDC corresponding process, let it return to your memDC,...CodePudding user response:
Or MapX is open source, use memDC directly modify the relevant source codeCodePudding user response:
@ 4 teacher zhaoUse WinAPIOverride, Hook MapX GetDC corresponding process, let it return to your memDC,...
For this I understand, but also has the very big difficult to perform, whether can be done directly through the code way DC_map memDC to replace, also please miss zhao glad, thanks!
(the other, MapInfo one-time displayed when also can achieve scale effect, I wonder if MapInfo and adopt the way of the Hook)
CodePudding user response:
Into a case, only supplies the reference:/*
Application: Code Injection in Explorer
Author: @ _RT
Compiled on: Feb 2014
URL:http://www.codeproject.com/Tips/732044/Code-Injection-2
We will see the company's steps involved to perform a code injection into an already running process.
Following are the quick steps through the process of injection.
1. Get the API addresses that will be calling from the injected code.
2. Prepare the shell code of your function that you want to get executed from the injected process.
3. Get the process ID of the running process that wish to inject into by enumerating through the
A list of the processes or by finding the process 's window (in case it' s a GUI application) by the class name or title.
4. Open the process using its Pid with All Access rights.
5. The Allocate company's memory Spaces in the process that you are going to inject the to with desired access
Does the for holding the company segments of your shell code.
Code part (the executable instructions)
The Data part (strings, the function parameters, etc.)
6. Write the allocated memories with the respective values (code and data).
7. Call CreateRemoteThread API and pass it to the start of the allocated memory address where you have
Written your shell code from the process we are injecting.
*/
# include & lt; Windows. H>
# pragma comment (lib, "user32. Lib")
LPVOID addr.
LPVOID addr2;
BOOL InjectExecutable (DWORD dwPid LPVOID si, LPVOID PI, int sisize, int pisize)
{
LPVOID hNewModule;
HANDLE hProcess;
CHAR [] S={" C: \ \ Windows \ \ system32 \ \ notepad exe "};
X6a BYTE byt []={0, 0 x00 to 0 x6a, 0 x00 to 0 x6a, 0 x00 to 0 x6a, 0 x01, 0 x6a, 0 x00 to 0 x6a, 0 x00 to 0 x6a, 0 x00 to 0 x68};
//push 0, push 0, push 0, 1, push push 0, push 0, push 0, push 0 XXXXXXXXX
BYTE byt2 []=xe8 {0};//call 0 XXXXXXXXX
BYTE byt3 []=x68 {0};//push 0 XXXXXXXXX
HProcess=OpenProcess (PROCESS_ALL_ACCESS, FALSE, dwPid);
If (hProcess==NULL)
{
return FALSE;
}
LPVOID staddr=VirtualAllocEx (hProcess, NULL, sizeof (S), MEM_COMMIT, PAGE_READWRITE);
WriteProcessMemory (hProcess, staddr, S, sizeof (S), NULL);
LPVOID fnaddr=VirtualAllocEx (hProcess, NULL, 4, MEM_COMMIT, PAGE_READWRITE);
WriteProcessMemory (hProcess, fnaddr, PI, sisize, NULL);
LPVOID fnaddr2=VirtualAllocEx (hProcess, NULL, 4, MEM_COMMIT, PAGE_READWRITE);
WriteProcessMemory (hProcess, fnaddr2, si, pisize, NULL);
HNewModule=VirtualAllocEx (hProcess, NULL, 100, MEM_COMMIT, PAGE_EXECUTE_READWRITE); nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull