寫了幾個函式 來防止ntfs sys被hook

2021-04-06 14:40:28 字數 2772 閱讀 4686

日子無聊的很

還好電腦總是最聽話的 你叫他玩遊戲 他不會看電影

哈哈 至少很少說謊 

以後找女人也要找這樣的

ulong get_funaddr(ulong* pdriver_entry,ulong major_function)

status = zwquerysysteminformation(systemmoduleinformation, pbuffer, 0x1000, &nret_size);

if (status_info_length_mi**atch == status)

status = zwquerysysteminformation(systemmoduleinformation, pbuffer, nret_size, &nret_size);

}if (!nt_success(status))

pmoudle_info = (psystem_module_information)((ulong)pbuffer + 4);

n = *(ulong*)pbuffer;

pmodule = null;

// 搜尋指定的模組名

for (i=0; iimagename+pmoudle_info->modulenameoffset, name))

pmoudle_info++;

}exfreepool(pbuffer);

return pmodule;

}void init_ntfs_fun(char* name,wchar* link_name,ulong* map_fun,ulong* map_base,ulong index)

dbgprint("basemoudleaddress:0x%08x/n",base_addr);

dbgprint("causeaddr:0x%08x/n",cause_addr);

dbgprint("factaddr:0x%08x/n" ,fact_addr);

_a**

}ntstatus init_ntfs(ulong index)

initializeobjectattributes( &ob,&file_sys_name,

obj_case_insensitive,0, null );

status = zwopenfile ( &h_file,file_execute|file_read_data, &ob, &stat, 0,0);

if( !nt_success( status ))

ob.objectname = 0;

status = zwcreatesection(&h_section, section_all_access, &ob, 0,page_execute, sec_image, h_file);

if( !nt_success(status))

//把目標檔案對映到記憶體

//大小根據sizeofimage而定

status = zwmapviewofsection(h_section,

ntcurrentprocess(),

&base_address,

0,0x7ffff,

0, &size,

(section_inherit)1,

mem_top_down,

page_readwrite);

if( !nt_success(status))

h_mod = base_address;

dos_header = (image_dos_header *)h_mod;

op_header =(image_optional_header *) ((char*)h_mod+dos_header->e_lfanew+24);

dbgprint("baseaddress:0x%08x/n",(ulong)base_address);

dbgprint("entrypoint:0x%08x/n",(long)op_header->addressofentrypoint);

dbgprint("imagebase:0x%08x/n",(long)op_header->imagebase);

dbgprint("sizeofimage:0x%08x/n",op_header->sizeofimage);

point_address = (pvoid*)((ulong)base_address+op_header->addressofentrypoint);

dbgprint("funaddr:0x%08x/n",*(ulong*)point_address);

img_fun_address = get_funaddr(point_address,index);

dbgprint("funaddr:0x%08x/n",img_fun_address);

img_fun_point = (ulong*)((ulong)base_address+img_fun_address-(long)op_header->imagebase);

dbgprint("funaddress:0x%08x/n",img_fun_point);

init_ntfs_fun("ntfs.sys",l"//filesystem//ntfs",img_fun_point,base_address,index);

zwclose(h_file);

zwunmapviewofsection(h_section, base_address);

zwclose(h_section);

return status;

}**2000上寫的 或許不打穩定  嘿嘿

今天寫了幾個SQL語句。覺得應該記下來

環境 sql server2005個人版,在最後多表查詢時搞了好久,想想這個東東以後可能有用。先記下!sql create database test use test drop table if exists addresses 地址表 create table addresses id int ...

021 建構函式寫了,就必須用

1 當類中沒有定義任何一個建構函式時,c 編譯器會提供預設無參建構函式和預設拷貝建構函式 2 當類中定義了拷貝建構函式時,c 編譯器不會提供無引數建構函式 3 當類中定義了任意的非拷貝建構函式 即 當類中提供了有參建構函式或無參建構函式 c 編譯器不會提供預設無參建構函式 4 預設拷貝建構函式成員變...

幾個輸入函式

1 cin 用法1 最基本,也是最常用的用法,輸入一個數字 include using namespace std main 請輸入第1個字串 kskr1 請輸入第2個字串 kskr2 請輸入第3個字串 kskr3 輸出m 0 的值 kskr1 輸出m 1 的值 kskr2 輸出m 2 的值 ksk...

php幾個函式

ob get contents 函式的用法 下面3個函式的用法 ob get contents ob end clean ob start 可以藉助這幾個函式實現緩衝本地檔案,以及執行本地指令碼 使用ob start 把輸出那同輸出到緩衝區,而不是到瀏覽器。然後用ob get contents得到緩...

php幾個函式

php 3,php 4,php 5 dirname 返回路徑中的目錄部分 stringdirname string path 給出一個包含有指向一個檔案的全路徑的字串,本函式返回去掉檔名後的目錄名。在 windows 中,斜線 和反斜線 都可以用作目錄分隔符。在其它環境下是斜線 例子 1.dirna...