SHARE
TWEET

Untitled

a guest Mar 9th, 2010 357 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. BOOL CSteamDllApi::LoadSteamDll( LPCTSTR pszSteamDir )
  2. {
  3. #       ifdef   LOG_ENABLE
  4.         ON_LOG_FUNCTION( va_string( " ---> LoadSteamDll( %s )\n", pszSteamDir ));
  5. #       endif   //ifdef LOG_ENABLE
  6.  
  7.         CString csTemp;
  8.         BOOL    fRC     = FALSE;
  9.  
  10.         //      Check if Steam DLL Loaded etc
  11.         if      ( m_fSteamDllLoaded )
  12.         {
  13.                 //      Steam DLL is loaded
  14.                 if      ( m_csSteamDir.CompareNoCase( pszSteamDir ) == 0 )
  15.                 {
  16.                         return  TRUE;
  17.                 }
  18.                 //      Free the DLL
  19.                 UnloadSteamDll();
  20.                 if      (m_hInstSteam)
  21.                 {
  22.                         FreeLibrary(m_hInstSteam);
  23.                 }
  24.                 m_hInstSteam    = NULL;
  25.  
  26.                 if      ( m_hClientDll )
  27.                 {
  28.                         FreeLibrary( m_hClientDll );
  29.                 }
  30.                 m_hClientDll    = NULL;
  31.  
  32.         }
  33.         m_fSteamDllLoaded       = FALSE;
  34.  
  35.         //      Load the DLL now
  36.         m_csSteamDir    = pszSteamDir;
  37.         csTemp                  = m_csSteamDir;
  38.         csTemp                  += "steam.dll";
  39.  
  40.         m_hInstSteam    = LoadLibrary( csTemp );
  41.        
  42.         //      Load the Client DLL now
  43.         m_csSteamDir    = pszSteamDir;
  44.         csTemp                  = m_csSteamDir;
  45.         csTemp                  += "steamclient.dll";
  46.  
  47.         //m_hClientDll  = LoadLibrary( csTemp );
  48.         m_hClientDll = LoadLibraryEx( csTemp, NULL, LOAD_WITH_ALTERED_SEARCH_PATH);
  49.  
  50.         if ((!m_hInstSteam) || (!m_hClientDll ))
  51.         {
  52.                 //      Load Library fails
  53.                 m_dwError       = GetLastError();
  54.  
  55.                 fRC                     = FALSE;
  56.         }
  57.         else
  58.         {
  59.  
  60.                 //      Load Library succeeds
  61.                 fRC                     = TRUE;
  62.                 //      From UncleD
  63.                 pfnSteamGetEncryptionKeyToSendToNewClient       = (SteamGetEncryptionKeyToSendToNewClient)GetProcAddress( m_hInstSteam, "SteamGetEncryptionKeyToSendToNewClient" );
  64.                 pfnSteamGetEncryptedUserIDTicket                        = (SteamGetEncryptedUserIDTicket)GetProcAddress( m_hInstSteam, "SteamGetEncryptedUserIDTicket" );
  65.  
  66.                 //      Now load the function pointers
  67.                 pfnSteamStartEngine             = (SteamStartEngine)GetProcAddress( m_hInstSteam, "SteamStartEngine" );
  68.                 pfnSteamStartup                 = (SteamStartup)GetProcAddress( m_hInstSteam, "SteamStartup" );
  69.                 pfnSteamLogin                   = (SteamLogin)GetProcAddress( m_hInstSteam, "SteamLogin" );
  70.                 pfnSteamIsLoggedIn              = (SteamIsLoggedIn)GetProcAddress( m_hInstSteam, "SteamIsLoggedIn" );
  71.                 pfnSteamSetUser                 = (SteamSetUser)GetProcAddress( m_hInstSteam, "SteamSetUser" );
  72.                 pfnSteamGetUser                 = (SteamGetUser)GetProcAddress( m_hInstSteam, "SteamGetUser" );
  73.  
  74.                 pfnSteamAbortCall               = (SteamAbortCall)GetProcAddress( m_hInstSteam, "SteamAbortCall" );
  75.  
  76.                 pfnSteamLogout                  = (SteamLogout)GetProcAddress( m_hInstSteam, "SteamLogout" );
  77.                 pfnSteamCleanup                 = (SteamCleanup)GetProcAddress( m_hInstSteam, "SteamCleanup" );
  78.                 pfnSteamShutdownEngine  = (SteamShutdownEngine)GetProcAddress( m_hInstSteam, "SteamShutdownEngine" );
  79.  
  80.                 pfnSteamProcessCall             = (SteamProcessCall)GetProcAddress( m_hInstSteam, "SteamProcessCall" );
  81.                 //      Application
  82.                 pfnSteamLaunchApp               = (SteamLaunchApp)GetProcAddress( m_hInstSteam, "SteamLaunchApp" );
  83.                 pfnSteamGetAppStats             = (SteamGetAppStats)GetProcAddress( m_hInstSteam, "SteamGetAppStats" );
  84.                 pfnSteamGetAppIds               = (SteamGetAppIds)GetProcAddress( m_hInstSteam, "SteamGetAppIds" );
  85.                 pfnSteamEnumerateApp    = (SteamEnumerateApp)GetProcAddress( m_hInstSteam, "SteamEnumerateApp" );
  86.                 pfnSteamIsAppSubscribed = (SteamIsAppSubscribed)GetProcAddress( m_hInstSteam, "SteamIsAppSubscribed" );
  87.                 pfnSteamEnumerateAppLaunchOption        = (SteamEnumerateAppLaunchOption)GetProcAddress( m_hInstSteam, "SteamEnumerateAppLaunchOption" );
  88.                 pfnSteamGetAppDir                                       = (SteamGetAppDir)GetProcAddress( m_hInstSteam, "SteamGetAppDir" );
  89.                 pfnSteamGetAppUserDefinedInfo           = (SteamGetAppUserDefinedInfo)GetProcAddress( m_hInstSteam, "SteamGetAppUserDefinedInfo" );
  90.  
  91.                 //      Subscription hooks
  92.                 pfnSteamGetSubscriptionStats    = (SteamGetSubscriptionStats)GetProcAddress( m_hInstSteam, "SteamGetSubscriptionStats" );
  93.                 pfnSteamGetSubscriptionIds              = (SteamGetSubscriptionIds)GetProcAddress( m_hInstSteam, "SteamGetSubscriptionIds" );
  94.                 pfnSteamEnumerateSubscription   = (SteamEnumerateSubscription)GetProcAddress( m_hInstSteam, "SteamEnumerateSubscription" );
  95.                 pfnSteamIsSubscribed                    = (SteamIsSubscribed)GetProcAddress( m_hInstSteam, "SteamIsSubscribed" );
  96.  
  97.                 //      --->    --------------------------      <---
  98.                 //      --->    Setup Uncle_D's Interfaces      <---
  99.                 //      --->    --------------------------      <---
  100.                 //pfnBGetCallback = (BGetCallback *)GetProcAddress( m_hClientDll,"Steam_BGetCallback");
  101.                 //pfnFreeLastCallback = (FreeLastCallback *)GetProcAddress( m_hClientDll,"FreeLastCallback");
  102.                 //pfnBGetCallback = (BGetCallback)GetProcAddress( m_hClientDll,"Steam_BGetCallback");
  103.                 //pfnFreeLastCallback = (FreeLastCallback)GetProcAddress( m_hClientDll,"FreeLastCallback");
  104.                 pfnBGetCallback = (BGetCallback)GetProcAddress( m_hClientDll,"Steam_BGetCallback");
  105.                 pfnFreeLastCallback = (FreeLastCallback)GetProcAddress( m_hClientDll,"Steam_FreeLastCallback");
  106.  
  107.                 //CreateInterface
  108.                 pfnCreateInterface = (CreateInterface) GetProcAddress( m_hClientDll, "CreateInterface" );
  109.  
  110.                 //IClientEngine*
  111.                 pSteamClient    = pfnCreateInterface(CLIENTENGINE_INTERFACE_VERSION, NULL);             //
  112.                 g_hUser                 = pSteamClient->CreateGlobalUser( &g_hPipe );
  113.  
  114.                 //pSteamClient009 = (ISteamClient009 *)pfnCreateInterface("SteamClient009", NULL);
  115.  
  116.                 //pSteamUser005 = (ISteamUser005 *)pSteamClient009->GetISteamUser( g_hUser, g_hPipe, "SteamUser005");
  117.  
  118.                 //IClientUser*
  119.                 pClientUser = (IClientUser *)pSteamClient->GetIClientUser( g_hUser, g_hPipe, CLIENTUSER_INTERFACE_VERSION);
  120. //              m_fWorkerActive2        = true;
  121.  
  122.                 //
  123.                 //
  124.                 m_fSteamDllLoaded                               = TRUE;
  125.         }
  126.         return  fRC;
  127. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top