int main() { HMODULE lib; lib = myload("win32.section-max.dll.dll"); FreeLibrary(lib); return 0; }
int main() { HMODULE lib1; HMODULE lib2; lib1 = myload("win32.rebased.dll.dll"); /* We used to just load the 8.3 name, but the Win8+ loader no longer loads a * separate copy that way. Now we make an explicit separate copy. */ lib2 = myload("win32.rebased2.dll.dll"); if (lib1 == lib2) { print("there is a problem - should have collided, maybe missing\n"); } FreeLibrary(lib1); FreeLibrary(lib2); return 0; }
int main() { HMODULE lib1; HMODULE lib2; /* same as rebased test */ lib1 = myload("win32.multisec.dll.dll"); lib2 = myload("win32m~1.dll"); if (lib1 == lib2) { print("there is a problem - should have collided, maybe missing\n"); } f(); func3(); func4(); FreeLibrary(lib1); FreeLibrary(lib2); return 0; }
int main() { HMODULE lib; HMODULE cmd; int res; lib = myload("security-win32.sec-fixed.dll.dll"); FreeLibrary(lib); /* unclear what this code is supposed to do on other platforms * FIXME: move to its own load-exe */ /* real use seen of PCHealth\HelpCtr\Binaries\HelpCtr.exe */ cmd = LoadLibraryExW(L"cmd.exe", NULL, LOAD_LIBRARY_AS_DATAFILE); assert(cmd != NULL); res = FreeLibrary(cmd); assert(res); print("cmd.exe as data\n"); /* FIXME: for some reason the loader reuses the exe - if we ask for cmd.exe again here */ cmd = LoadLibraryExW(L"calc.exe", NULL, DONT_RESOLVE_DLL_REFERENCES | LOAD_LIBRARY_AS_DATAFILE); assert(cmd != NULL); res = FreeLibrary(cmd); assert(res); print("calc.exe as data and no resolve\n"); /* note that windbg will show only this one as a module */ cmd = LoadLibraryExW(L"rundll32.exe", NULL, DONT_RESOLVE_DLL_REFERENCES); assert(cmd != NULL); res = FreeLibrary(cmd); assert(res); print("rundl32.exe as no resolve\n"); print("done\n"); return 0; }
int kexec (char *ufilename){ int success, i; char kfilename[FILENAMELEN]; char *cp = kfilename; int count = 0; u16 segment = running->uss; while (count < FILENAMELEN){ *cp = get_byte(running->uss, ufilename); if (*cp == 0) break; cp++; ufilename++; count++; } kfilename[FILENAMELEN - 1] = 0; //printf("proc %d exec(%s) attempt ", running->pid, kfilename); //success = kkexec(file); //printf("load: %d\n", load(kfilename, segment)); //gets(kfilename); // for (i=1; i<= 32 * 1024; i++){ // put_word(0, segment, 2*i); //} if(!myload(kfilename, segment)){ printf("failed at %x\n", segment); return -1; } //load(kfilename, segment); /************************************************** We know segment=0x2000 + index*0x1000 ====> ustack is at the high end of this segment, say TOP. We must make ustak contain: 1 2 3 4 5 6 7 8 9 10 11 12 flag uCS uPC ax bx cx dx bp si di es ds 0x0200 seg 0 0 0 0 0 0 0 0 seg seg So, first a loop to set all to 0, then put_word(seg, segment, -2*i); i=2,11,12;*/ for (i=1; i<=12; i++){ put_word(0, segment, -2*i); } put_word(0x0200, segment, -2*1); /* flag */ put_word(segment, segment, -2*2); /* uCS */ put_word(segment, segment, -2*11); /* uES */ put_word(segment, segment, -2*12); /* uDS */ printf("success at %x\n", segment); /* initial USP relative to USS */ running->usp = -2*12; //running->uss = segment; return running->pid; }