KernelMode | UserMode
nt!KeUserModeCallBack | --> user32!__ClientLoadLibrary
int __stdcall __ClientLoadLibrary(int a1)
{
void *v1; // edi@2
const WCHAR *v2; // eax@3
HMODULE v3; // esi@4
FARPROC v4; // eax@5
void *v6; // [sp+Ch] [bp-120h]@10
int v7; // [sp+10h] [bp-11Ch]@10
int v8; // [sp+14h] [bp-118h]@1
int v9; // [sp+1Ch] [bp-110h]@1
int v10; // [sp+20h] [bp-10Ch]@1
CHAR ProcName; // [sp+24h] [bp-108h]@1
char Dst; // [sp+25h] [bp-107h]@1
unsigned int v13; // [sp+128h] [bp-4h]@1
int v14; // [sp+12Ch] [bp+0h]@1
v13 = (unsigned int)&v14 ^ __security_cookie;
ProcName = 0;
memset(&Dst, 0, 0x103u);
v8 = 0;
v9 = 0;
v10 = 0;
if ( *(_DWORD *)(a1 + 8) && !*(_DWORD *)(a1 + 20) )
FixupCallbackPointers(a1);
v1 = LoadLibraryExW(*(LPCWSTR *)(a1 + 0x1C), 0, 8u);
if ( v1 )
{
v2 = *(const WCHAR **)(a1 + 0x24);
if ( v2 )
{
v3 = v1;
v1 = (void *)WideCharToMultiByte(0, 0x400u, v2, -1, &ProcName, 260, 0, 0);
if ( !v1 )
goto LABEL_16;
v4 = GetProcAddress(v3, &ProcName);
if ( !v4 || !InitUserApiHook(v3, v4) )
v1 = 0;
if ( v1 )
v1 = v3;
else
LABEL_16:
FreeLibrary(v3);
}
}
v6 = v1;
v7 = 0;
return NtCallbackReturn(&v6, 24, 0);
}
KeUserModeCallback这个函数只是一个工具一个入口而已,真正需要去学习的是他后面的那张KernelCallbackTable表。
0:005> dt ntdll!_PEB 7efde000
+0x000 InheritedAddressSpace : 0 ''
+0x001 ReadImageFileExecOptions : 0 ''
……………………
……………………
+0x02c KernelCallbackTable : 0x7506b9f0 Void
0:005> dds 0x7506b9f0
7506b9f0 750af230 USER32!__fnCOPYDATA
7506b9f4 750af1ba USER32!__fnCOPYGLOBALDATA
7506b9f8 75066e19 USER32!__fnDWORD
7506b9fc 750699f4 USER32!__fnNCDESTROY
7506ba00 7508b8fa USER32!__fnDWORDOPTINLPMSG
7506ba04 750af30a USER32!__fnINOUTDRAG
7506ba08 75071f46 USER32!__fnGETTEXTLENGTHS
7506ba0c 750af6ee USER32!__fnINCNTOUTSTRING
7506ba10 750af7a1 USER32!__fnINCNTOUTSTRINGNULL
7506ba14 750af539 USER32!__fnINLPCOMPAREITEMSTRUCT
7506ba18 7506a6d8 USER32!__fnINLPCREATESTRUCT
7506ba1c 750af582 USER32!__fnINLPDELETEITEMSTRUCT
7506ba20 7507981e USER32!__fnINLPDRAWITEMSTRUCT
7506ba24 750af626 USER32!__fnINLPHELPINFOSTRUCT
7506ba28 750af5cb USER32!__fnINLPHLPSTRUCT
7506ba2c 750af356 USER32!__fnINLPMDICREATESTRUCT
7506ba30 750798a4 USER32!__fnINOUTLPMEASUREITEMSTRUCT
7506ba34 75068f7b USER32!__fnINLPWINDOWPOS
7506ba38 75068aab USER32!__fnINOUTLPPOINT5
7506ba3c 75078759 USER32!__fnINOUTLPSCROLLINFO
7506ba40 7508efda USER32!__fnINOUTLPRECT
7506ba44 750685e8 USER32!__fnINOUTNCCALCSIZE
7506ba48 75068edb USER32!__fnINOUTLPWINDOWPOS
7506ba4c 750af3b2 USER32!__fnINPAINTCLIPBRD
7506ba50 750af426 USER32!__fnINSIZECLIPBRD
7506ba54 750af499 USER32!__fnINDESTROYCLIPBRD
7506ba58 7508bf58 USER32!__fnINSTRING
7506ba5c 7508f11c USER32!__fnINSTRINGNULL
7506ba60 7508c4c1 USER32!__fnINDEVICECHANGE
7506ba64 7508dce4 USER32!__fnPOWERBROADCAST
7506ba68 750af94a USER32!__fnINOUTNEXTMENU
7506ba6c 750af16a USER32!__fnOPTOUTLPDWORDOPTOUTLPDWORD
7506ba70 750af0cb USER32!__fnOUTDWORDDWORD
7506ba74 750af11b USER32!__fnOUTDWORDINDWORD
7506ba78 750af4ea USER32!__fnOUTLPRECT
7506ba7c 75071e6f USER32!__fnOUTSTRING
7506ba80 750af8ef USER32!__fnPOPTINLPUINT
7506ba84 750af848 USER32!__fnPOUTLPINT
7506ba88 750af295 USER32!__fnSENTDDEMSG
7506ba8c 7507341c USER32!__fnINOUTSTYLECHANGE
7506ba90 7506810b USER32!__fnHkINDWORD
7506ba94 7507b224 USER32!__fnHkINLPCBTACTIVATESTRUCT
7506ba98 750783a7 USER32!__fnHkINLPCBTCREATESTRUCT
7506ba9c 750afa68 USER32!__fnHkINLPDEBUGHOOKSTRUCT
7506baa0 75072bd4 USER32!__fnHkINLPMOUSEHOOKSTRUCTEX
7506baa4 750af9dc USER32!__fnHkINLPKBDLLHOOKSTRUCT
7506baa8 750afa22 USER32!__fnHkINLPMSLLHOOKSTRUCT
7506baac 75068b52 USER32!__fnHkINLPMSG
7506bab0 750af996 USER32!__fnHkINLPRECT
7506bab4 750b06f9 USER32!__fnHkOPTINLPEVENTMSG
7506bab8 7507ffcd USER32!__ClientCopyDDEIn1
7506babc 750800a9 USER32!__ClientCopyDDEIn2
7506bac0 750801fb USER32!__ClientCopyDDEOut1
7506bac4 75080118 USER32!__ClientCopyDDEOut2
7506bac8 7506e889 USER32!__ClientCopyImage
7506bacc 750afdcc USER32!__ClientEventCallback
7506bad0 750afe63 USER32!__ClientFindMnemChar
7506bad4 750afd50 USER32!__ClientFreeDDEHandle
7506bad8 75072eab USER32!__ClientFreeLibrary
7506badc 750afd08 USER32!__ClientGetCharsetInfo
7506bae0 750afd8e USER32!__ClientGetDDEFlags
7506bae4 750afe1d USER32!__ClientGetDDEHookData
7506bae8 750afbcb USER32!__ClientGetListboxString
7506baec 750afc77 USER32!__ClientGetMessageMPH
7506baf0 750afab6 USER32!__ClientLoadImage
7506baf4 7506aa64 USER32!__ClientLoadLibrary
7506baf8 750743bc USER32!__ClientLoadMenu
7506bafc 750b00f8 USER32!__ClientLoadLocalT1Fonts
7506bb00 750afebc USER32!__ClientPSMTextOut
7506bb04 750aff63 USER32!__ClientLpkDrawTextEx
7506bb08 750affce USER32!__ClientExtTextOutW
7506bb0c 750b003a USER32!__ClientGetTextExtentPointW
7506bb10 7508c5cc USER32!__ClientCharToWchar
7506bb14 750b0099 USER32!__ClientAddFontResourceW
7506bb18 75069d7d USER32!__ClientThreadSetup
7506bb1c 750b01d4 USER32!__ClientDeliverUserApc
7506bb20 750b016c USER32!__ClientNoMemoryPopup
7506bb24 750744d7 USER32!__ClientMonitorEnumProc
7506bb28 750733d1 USER32!__ClientCallWinEventProc
7506bb2c 750afcc9 USER32!__ClientWaitMessageExMPH
7506bb30 75070d56 USER32!__ClientWOWGetProcModule
7506bb34 750b0384 USER32!__ClientWOWTask16SchedNotify
7506bb38 750b01e7 USER32!__ClientImmLoadLayout
7506bb3c 7508d5bf USER32!__ClientImmProcessKey
7506bb40 750b0256 USER32!__fnIMECONTROL
7506bb44 750b060d USER32!__fnINWPARAMDBCSCHAR
7506bb48 75071f46 USER32!__fnGETTEXTLENGTHS
7506bb4c 750af681 USER32!__fnINLPKDRAWSWITCHWND
7506bb50 750b03cd USER32!__ClientLoadStringW
7506bb54 750bd941 USER32!__ClientLoadOLE
7506bb58 750bd7bd USER32!__ClientRegisterDragDrop
7506bb5c 750bd803 USER32!__ClientRevokeDragDrop
7506bb60 750b0335 USER32!__fnINOUTMENUGETOBJECT
7506bb64 750b0110 USER32!__ClientPrinterThunk
7506bb68 7508d48b USER32!__fnOUTLPCOMBOBOXINFO
7506bb6c 750b0475 USER32!__fnOUTLPSCROLLBARINFO
7506bb70 75075d80 USER32!__fnINLPUAHDRAWMENU
7506bb74 75075d20 USER32!__fnINLPUAHDRAWMENUITEM
7506bb78 75075cd4 USER32!__fnINLPUAHINITMENU
7506bb7c 75075ece USER32!__fnINOUTLPUAHMEASUREMENUITEM
7506bb80 7508c2ee USER32!__fnINLPUAHNCPAINTMENUPOPUP
7506bb84 750757d1 USER32!__fnOUTLPTITLEBARINFOEX
7506bb88 750b04f4 USER32!__fnTOUCH
7506bb8c 750b0553 USER32!__fnGESTURE
7506bb90 750b05b2 USER32!__fnINPGESTURENOTIFYSTRUCT
至于为什么,看看上面的代码就明白了,老V这篇写的不详细,我很想扩充来写一下