BanMe
August 7th, 2009, 21:11
eh wtf..
trying to make it work in win32..before moving to the native equivelent..
self storage..so much is available!?we can most likely use some?
for some reason its not writing.. and my head hurtz...
please some assistance?
BanMe
trying to make it work in win32..before moving to the native equivelent..
self storage..so much is available!?we can most likely use some?
Code:
wchar_t NativePath[255] = {0};
wchar_t *wString = {0};
IO_STATUS_BLOCK IOSB = {0};
LARGE_INTEGER li = {0}
NTSTATUS Status = 0;
ULONG dwWritten = 0;
__asm
{
xor eax,eax
add eax,0x30
mov eax,fs:[eax]//PEB!!!
mov eax,[eax+0x10]//RTL_USER_PROCESS_PARAMETERS!!!!
add eax,0x38//UNICODE_STRING ImagePathName;!!!!
mov eax,[eax][UNICODE_STRING.Buffer]//ImagePathName.Buffer!!!!!
push eax//PUSH the buffer
pop wString //pop it into a wchar*
}
//we now have the Win32 Path Name and not the NT Path Name...
//so we create our own Nt Path Name
wcscpy((wchar_t*)&NativePath,L"\\??\\";
wcscat((wchar_t*)&NativePath,wString);
//string looks like:
//\??\C:\Windows\System32\Sin32.exe
// : is the signifier for a file stream attached to a file
wcscat((wchar_t*)&NativePath,L"EBUG_STREAM"
;
//this is what it looks like with a File Stream specified
//\??\C:\Windows\System32\Sin32.exeEBUG_STREAM
//Init the Created String
RtlInitUnicodeString(&Unicode,(PCWSTR)&NativePath);
InitializeObjectAttributes(&oa,&Unicode,OBJ_OPENIF|OBJ_KERNEL_HANDLE,0,0);
li.QuadPart = 0x4096;
li.LowPart = 0x4096;
li.u.LowPart = 0x4096;
Status = NtCreateFile(&Reusable,GENERIC_WRITE,&oa,&IOSB,&li,FILE_ATTRIBUTE_NORMAL,FILE_SHARE_WRITE,FILE_OVERWRITE_IF,FILE_WRITE_THROUGH,0,0);
//try to write to the file stream
Recycler = WriteFile(Reusable,"This is Sin32EBUG_STREAM\r\n",29,&dwWritten,0);
//Flush File Stream...
FlushFileBuffers(Reusable);
CloseHandle(Reusable);
for some reason its not writing.. and my head hurtz...
please some assistance?
BanMe