diff options
author | pixel <pixel> | 2004-01-22 22:44:43 +0000 |
---|---|---|
committer | pixel <pixel> | 2004-01-22 22:44:43 +0000 |
commit | 7e96e72218e40a2fc3c49294d5156eb0e05b8e94 (patch) | |
tree | ce34db6414fc5528b3b2e51e02502a68f8808fac /PE | |
parent | 1badb6d6759b1836b8f4c6435693433b4f8d285c (diff) |
Having a cute patching system now
Diffstat (limited to 'PE')
-rw-r--r-- | PE/pepatch-res.h | 10 | ||||
-rw-r--r-- | PE/pepatch.cpp | 44 |
2 files changed, 49 insertions, 5 deletions
diff --git a/PE/pepatch-res.h b/PE/pepatch-res.h index 22e77f3..7559d25 100644 --- a/PE/pepatch-res.h +++ b/PE/pepatch-res.h @@ -4,7 +4,7 @@ //
#define IDI_ICON 101
#define IDD_PROGRESS 102
-#define IDB_AYA 103 +#define IDB_AYA 103
#define IDD_ABOUT 104
#define IDC_FILLOUT1 1001
#define IDC_FILLIN1 1002
@@ -13,17 +13,17 @@ #define IDC_INFO1 1005
#define IDC_INFO2 1006
#define IDC_INFO3 1007
- -#define IDC_PALFIX 1011 +#define IDC_PALFIX 1011
#define IDC_ABOUT 1012
+#define IDC_CUSTOM1 1013
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE 105 +#define _APS_NEXT_RESOURCE_VALUE 105
#define _APS_NEXT_COMMAND_VALUE 40001
-#define _APS_NEXT_CONTROL_VALUE 1013
+#define _APS_NEXT_CONTROL_VALUE 1014
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
diff --git a/PE/pepatch.cpp b/PE/pepatch.cpp index be67faf..80e6154 100644 --- a/PE/pepatch.cpp +++ b/PE/pepatch.cpp @@ -1,7 +1,51 @@ +#include <Output.h>
#include <Main.h>
+#include "pepatch-res.h"
+
+BOOL CALLBACK AboutDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam) {
+ Base::printm(M_STATUS, "AboutDlgProc: uMsg = %i (0x%x)\n", uMsg, uMsg);
+ switch (uMsg) {
+ case WM_COMMAND:
+ switch (LOWORD(wParam)) {
+ case IDCANCEL: DestroyWindow(hW); return TRUE;
+ case IDOK: DestroyWindow(hW); return TRUE;
+ }
+ }
+ return FALSE;
+}
CODE_BEGINS
virtual int startup() throw (GeneralException) {
+ verbosity = M_INFO;
+ HBITMAP bmp;
+ Output * out = new Output("TestBmp.bmp");
+ char buffer[2048];
+ DWORD readed;
+
+ DialogBox(0, MAKEINTRESOURCE(IDD_ABOUT),
+ GetActiveWindow(), 0);
+// ShowWindow(CreateDialog(0, MAKEINTRESOURCE(IDD_ABOUT), GetActiveWindow(), AboutDlgProc), SW_SHOWDEFAULT); + bmp = LoadBitmap(0, MAKEINTRESOURCE(IDB_AYA));
+
+ do {
+ if (!ReadFile(bmp, buffer, 2048, &readed, 0)) {
+ DWORD dwErrCode = GetLastError(); + LPVOID lpMsgBuf; + if (!FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | + FORMAT_MESSAGE_FROM_SYSTEM | + FORMAT_MESSAGE_IGNORE_INSERTS, + NULL, GetLastError(), + MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language + (LPTSTR) &lpMsgBuf, 0, NULL )) + throw GeneralException("Gave up on reading CD: unknown error"); + String errmsg = (LPCTSTR) lpMsgBuf; + LocalFree(lpMsgBuf); + throw GeneralException("Got error " + errmsg); + }
+ printm(M_INFO, "Read %i bytes\n", readed);
+ out->write(buffer, readed);
+ } while (readed != 0);
+
return 0;
}
CODE_ENDS
|