BugInTheSYS

Untitled

Oct 24th, 2011
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.53 KB | None | 0 0
  1. DWORD GetServerHandle( void ) {
  2.   HANDLE hFileMapping;
  3.   PDWORD pServerID;
  4.   DWORD Result = 0;
  5.   hFileMapping = CreateFileMapping( INVALID_HANDLE_VALUE, NULL, PAGE_READONLY, 0, sizeof(HANDLE), L"smartipc" );
  6.   if( hFileMapping ) {
  7.     pServerID = ( DWORD *)MapViewOfFile( hFileMapping, FILE_MAP_READ, 0,0,0 );
  8.     if( pServerID ) {
  9.       Result = *pServerID;
  10.       UnmapViewOfFile( pServerID );
  11.     }
  12.   } else Result = 0;
  13.   return Result;
  14. }
  15.  
  16. int _tmain(int argc, _TCHAR* argv[]) {
  17.   GetServerHandle();
  18.   getchar();
  19.   return 0;
  20. }
  21.  
Advertisement
Add Comment
Please, Sign In to add comment