Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "Header.h"
- int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR path, int)
- {
- HMODULE mod = LoadLibraryEx(path, NULL, LOAD_LIBRARY_AS_DATAFILE);
- if (!mod)
- {
- MessageBox(0, "Wrong Path.", "huhue", 0);
- }
- HRSRC rezPtr = FindResource(mod, "69", "swag");
- if (!rezPtr)
- {
- if (MessageBox(0, "Resource not found, would you like to add #swag to your file ?", "huhue", MB_YESNO) == IDYES) {
- FreeLibrary(mod);
- TCHAR* data = TEXT("#yolo");
- HANDLE rezHandle = BeginUpdateResource(path, false);
- if (!UpdateResource(rezHandle, "swag", "69", 0, data, tcslen(data)))
- {
- MessageBox(0, "ubrokesomeshit", "", 0);
- }
- if (!EndUpdateResource(rezHandle, false))
- {
- MessageBox(0, "ubrokesomeshit", "", 0);
- }
- }
- MessageBox(0, "Swag successfully added ! Now I must go." , "huhue", 0);
- return 0;
- }
- HGLOBAL f = LoadResource(mod, rezPtr);
- DWORD sz = SizeofResource(mod, rezPtr);
- TCHAR* resText = (TCHAR*)LockResource(f);
- TCHAR* text = (TCHAR*)malloc(sz);
- memcpy(text, resText, sz);
- text[sz] = 0;
- FreeResource(f);
- FreeLibrary(mod);
- TCHAR* Prechar = TEXT("Found the swag ! :");
- DWORD buff = _MAX_PATH + (tcslen(Prechar) / sizeof(TCHAR));
- TCHAR* fd = (TCHAR*)malloc(buff);
- tsprintf_s(fd, buff, "%s%s", Prechar , text);
- MessageBox(0, fd, "huhue", 0);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment