阅读:2288回复:4
WTSAPI32????????????????????
找了好久的资料。。
想看看WTSEnumerateSessionsW是如何实现的。才发现真难找。。 只想问个问题。 WTSEnumerateSessionsW调用的底层部分是由哪些函数组成的?。。。。 或者。。内核层取已经登陆的用户? 谢谢。。。 |
|
沙发#
发布于:2008-10-04 02:44
闷..
在虚拟机里装IDA.... wtsapi32.dll wtsapi32!WTSEnumerateSessions: BOOL WTSEnumerateSessions(IN HANDLE hServer, IN DWORD Reserved, IN DWORD Version, OUT PWTS_SESSION_INFOA * ppSessionInfo, OUT DWORD * pCount ) winsta.dll winsta!WinStationEnumerateW(hServer, &Version, &Reserved) DWORD (WINAPI *TWinStationEnumerateW)(HANDLE,DWORD,DWORD); 1 HANDLE 传入参数 2 接收1个长度为0x4c的数组地址的地址 传出参数 3 传入为可能的最大session数,传出为当前session数目 传入参数&&传出参数 rpcrt4.dll rpcrt4!NdrClientCall2(&pStubDescriptor, &byte_762D1248, &hServer) .text:762D1248 ; const unsigned __int8 byte_762D1248 .text:762D1248 byte_762D1248 db 0 ; DATA XREF: sub_762D3DF8+Co .text:762D1249 db 48h, 2 dup(0) .text:762D124C dd 30000h, 4C30001Ch, 0 .text:762D1258 dd 750078h, 7080747h, 10001h, 80000h, 0E0000h, 42150h .text:762D1258 dd 1580008h, 80008h, 0C001Bh, 1580016h, 80010h, 140158h .text:762D1258 dd 700008h, 20018h CLIENT_CALL_RETURN RPC_VAR_ENTRY NdrClientCall2( PMIDL_STUB_DESC pStubDescriptor, PFORMAT_STRING pFormat, ... ) |
|
板凳#
发布于:2008-10-04 02:46
最后发现..最终调的NdrClientCall2
char __stdcall WinStationEnumerateW(PVOID a1, HLOCAL *a2, int a3) { signed int v3; // eax@1 DWORD v4; // esi@1 HLOCAL *v5; // ebx@3 int v6; // edi@5 HLOCAL v7; // eax@6 HLOCAL v8; // edi@6 int v9; // esi@6 signed int v11; // ST14_4@21 UINT v12; // eax@3 HLOCAL v13; // eax@3 int v14; // edx@5 int v15; // eax@6 int v16; // eax@9 signed int v17; // [sp+24h] [bp-24h]@1 DWORD v18; // [sp+1Ch] [bp-2Ch]@1 UINT v19; // [sp+18h] [bp-30h]@3 HLOCAL hMem; // [sp+20h] [bp-28h]@3 int v21; // [sp+Ch] [bp-3Ch]@5 CPPEH_RECORD ms_exc; // [sp+30h] [bp-18h]@9 DWORD dwErrCode; // [sp+28h] [bp-20h]@9 char v24; // [sp+2Fh] [bp-19h]@9 v3 = 50; v17 = 50; v4 = 0; v18 = 0; if ( !a1 ) { if ( !Destination ) { if ( !sub_762D3AAB() ) return 0; v3 = v17; } a1 = Destination; } if ( a1 == (PVOID)-3 ) { v11 = 1151; goto LABEL_28; } *(_DWORD *)a3 = 0; v5 = a2; *a2 = 0; v12 = 76 * v3; v19 = v12; v13 = LocalAlloc(0, v12); hMem = v13; if ( !v13 ) { dwErrCode = 8; goto LABEL_12; } while ( 1 ) { if ( v18 == v4 ) goto LABEL_9; v6 = *(_DWORD *)a3; v21 = sub_762D3E1A(v17 + *(_DWORD *)a3, __MKCADD__(v17, *(_DWORD *)a3), 76, 0); if ( v14 ) break; v9 = 76 * v6; v15 = v6 + v17; *(_DWORD *)a3 = v6 + v17; v7 = LocalAlloc(0, 76 * v15); v8 = v7; if ( !v7 ) break; if ( *v5 ) { sub_762D3E37(v7, *v5, v9); LocalFree(*v5); } sub_762D3E37((char *)v8 + v9, hMem, 76 * v17); *v5 = v8; v4 = 0; LABEL_9: ms_exc.disabled = v4; v24 = sub_762D3DF8(a1, &dwErrCode, &v17, hMem, &v19, &v18); v16 = RtlNtStatusToDosError(dwErrCode); dwErrCode = v16; if ( v16 == 259 ) { dwErrCode = v4; ms_exc.disabled = -1; goto LABEL_11; } ms_exc.disabled = -1; } dwErrCode = 8; v4 = 0; LABEL_11: LocalFree(hMem); LABEL_12: if ( dwErrCode == v4 ) return 1; if ( *v5 != (HLOCAL)v4 ) { LocalFree(*v5); *v5 = (HLOCAL)v4; } v11 = dwErrCode; LABEL_28: SetLastError(v11); return 0; } |
|
地板#
发布于:2008-10-04 19:29
RPC了
|
|
|
地下室#
发布于:2008-10-05 00:30
不跟了..
看着那堆东西难受. |
|