Advertisement
Guest User

Untitled

a guest
Nov 15th, 2012
1,178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 9.96 KB | None | 0 0
  1. /*
  2.  * steam_api.dll
  3.  *
  4.  * Generated from steam_api.dll by winedump.
  5.  *
  6.  * DO NOT SUBMIT GENERATED DLLS FOR INCLUSION INTO WINE!
  7.  *
  8.  */
  9.  
  10. #include "config.h"
  11.  
  12. #include <stdarg.h>
  13. #include <dlfcn.h>
  14. #include "windef.h"
  15. #include "winbase.h"
  16. #include "wine/debug.h"
  17. #include "steam_api_header.h"
  18. WINE_DEFAULT_DEBUG_CHANNEL(steam_api);
  19.  
  20. struct _funcs_t {
  21.     const char * fName;
  22.     void (*ptr)();
  23. };
  24.  
  25. void stubFn(void) {
  26.     TRACE("steam_api.STUB\n");
  27. }
  28.  
  29. #define STUB stubFn
  30.  
  31. static struct _funcs_t funcs[] = {
  32.     { "GetHSteamPipe", STUB },  { "GetHSteamUser", STUB },  { "SteamAPI_GetHSteamPipe", STUB }, { "SteamAPI_GetHSteamUser", STUB }, { "SteamAPI_GetSteamInstallPath", STUB },
  33.     { "SteamAPI_InitSafe", STUB }, { "SteamAPI_Init", STUB },  { "SteamAPI_IsSteamRunning", STUB },  { "SteamAPI_RegisterCallback", STUB }, { "SteamAPI_RegisterCallResult", STUB },
  34.     { "SteamAPI_UnregisterCallback", STUB },        // 10
  35.     { "SteamAPI_UnregisterCallResult", STUB }, { "SteamAPI_RestartAppIfNecessary", STUB }, { "SteamAPI_RunCallbacks", STUB }, { "SteamAPI_SetBreakpadAppID", STUB },    
  36.     { "SteamAPI_SetMiniDumpComment", STUB }, { "SteamAPI_SetTryCatchCallbacks", STUB }, { "SteamAPI_Shutdown", STUB }, { "SteamAPI_UseBreakpadCrashHandler", STUB },
  37.     { "SteamAPI_WriteMiniDump", STUB },
  38.     { "SteamApps", STUB },              // 20
  39.     { "SteamClient", STUB }, { "SteamContentServer", STUB }, { "SteamContentServerUtils", STUB }, { "SteamContentServer_Init", STUB }, { "SteamContentServer_RunCallbacks", STUB },
  40.     { "SteamFriends", STUB }, { "SteamGameServer", STUB }, { "SteamGameServerUtils", STUB }, { "SteamMasterServerUpdater", STUB },
  41.     { "SteamGameServerNetworking", STUB },      // 30
  42.     { "SteamGameServerStats", STUB }, { "SteamGameServer_BSecure", STUB },  { "SteamGameServer_GetHSteamPipe", STUB },  { "SteamGameServer_GetHSteamUser", STUB },
  43.     { "SteamGameServer_GetIPCCallCount", STUB }, { "SteamGameServer_GetSteamID", STUB },  { "SteamGameServer_Init", STUB },  { "SteamGameServer_InitSafe", STUB },
  44.     { "SteamGameServer_RunCallbacks", STUB },
  45.     { "SteamContentServer_Shutdown", STUB }, // 40
  46.     { "SteamMatchmaking", STUB }, { "SteamMatchmakingServers", STUB }, { "SteamNetworking", STUB }, { "SteamRemoteStorage", STUB },
  47.     { "SteamUser", STUB }, { "SteamUserStats", STUB }, { "SteamUtils", STUB },  { "Steam_GetHSteamUserCurrent", STUB }, { "Steam_RegisterInterfaceFuncs", STUB },
  48.     { "Steam_RunCallbacks", STUB }, // 50
  49.     { "SteamHTTP", STUB },
  50.     { "SteamScreenshots", STUB }
  51.    
  52. };
  53.  
  54. #define JUMP(a) \
  55.     TRACE("call proxy \n"); \
  56.     asm("movl %0,%%eax; jmp %%eax" :: "r"(*funcs[a].ptr));
  57.  
  58.  
  59.  
  60. S_API HSteamPipe STEAM_CALL
  61.     GetHSteamPipe()
  62. {
  63.     // 0
  64.     JUMP(0);
  65.     return 0;
  66. }
  67.  
  68. S_API HSteamUser STEAM_CALL
  69.     GetHSteamUser()
  70. {
  71.     // 1
  72.     JUMP(1);
  73.     return 0;
  74. }
  75.  
  76. S_API HSteamPipe STEAM_CALL
  77.     SteamAPI_GetHSteamPipe()
  78. {
  79.     // 2
  80.     JUMP(2);
  81.     return 0;
  82. }
  83.  
  84. S_API HSteamUser STEAM_CALL
  85.     SteamAPI_GetHSteamUser()
  86. {
  87.     // 3
  88.     JUMP(3);
  89.     return 0;
  90. }
  91.  
  92.  
  93. S_API const char* STEAM_CALL
  94.     SteamAPI_GetSteamInstallPath()
  95. {
  96.     // 4
  97.     JUMP(4);
  98.     return NULL;
  99. }
  100.  
  101. S_API bool STEAM_CALL
  102.     SteamAPI_InitSafe()
  103. {
  104.     // 5
  105.     JUMP(5);
  106.     return 0;
  107. }
  108.  
  109. S_API bool STEAM_CALL
  110.     SteamAPI_Init()
  111. {
  112.     // 6
  113.     JUMP(6);
  114.     return 0;
  115. }
  116.  
  117.  
  118. S_API bool
  119.     SteamAPI_IsSteamRunning()
  120. {
  121.     // 7
  122.     JUMP(7);
  123.     return 1;
  124. }
  125.  
  126. S_API void
  127.     SteamAPI_RegisterCallback( PCallbackBase pCallback, int iCallback )
  128. {
  129.     // 8
  130.     JUMP(8);
  131. }
  132.  
  133. S_API void
  134.     SteamAPI_RegisterCallResult( PCallbackBase pCallback, SteamAPICall_t hAPICall )
  135. {
  136.     // 9
  137.     JUMP(9);
  138. }
  139.  
  140. S_API void
  141.     SteamAPI_UnregisterCallback( PCallbackBase pCallback )
  142. {
  143.     // 10
  144.     JUMP(10);
  145. }
  146.  
  147.  
  148. S_API void
  149.     SteamAPI_UnregisterCallResult( PCallbackBase pCallback, SteamAPICall_t hAPICall )
  150. {
  151.     // 11
  152.     JUMP(11);
  153. }
  154.  
  155. S_API bool
  156.     SteamAPI_RestartAppIfNecessary( uint32_t unOwnAppID )
  157. {
  158.     // 12
  159.     JUMP(12);
  160.     return 0;
  161. }
  162.  
  163. S_API void
  164.     SteamAPI_RunCallbacks()
  165. {
  166.     // 13
  167.     JUMP(13);
  168. }
  169.  
  170. S_API void
  171.     SteamAPI_SetBreakpadAppID( uint32_t unAppID )
  172. {
  173.     // 14
  174.     JUMP(14);
  175. }
  176.  
  177.  
  178. S_API void
  179.     SteamAPI_SetMiniDumpComment( const char *pchMsg )
  180. {
  181.     // 15
  182.     JUMP(15);
  183. }
  184.  
  185. S_API void STEAM_CALL
  186.     SteamAPI_SetTryCatchCallbacks( bool bTryCatchCallbacks )
  187. {
  188.     // 16
  189.     JUMP(16);
  190. }
  191.  
  192. S_API void
  193.     SteamAPI_Shutdown()
  194. {
  195.     // 17
  196.     JUMP(17);
  197. }
  198.  
  199. S_API void
  200.     SteamAPI_UseBreakpadCrashHandler( char const *pchVersion, char const *pchDate, char const *pchTime, bool bFullMemoryDumps, void *pvContext, PFNPreMinidumpCallback m_pfnPreMinidumpCallback )
  201. {
  202.     // 18
  203.     JUMP(18);
  204. }
  205.  
  206. S_API void
  207.     SteamAPI_WriteMiniDump( uint32_t uStructuredExceptionCode, void* pvExceptionInfo, uint32_t uBuildID )
  208. {
  209.     // 19
  210.     JUMP(19);
  211. }
  212.  
  213. S_API_UNSAFE /* ISteamApps003*/ void* STEAM_CALL
  214.     SteamApps()
  215. {
  216.     // 20
  217.     JUMP(20);
  218.     return NULL;
  219. }
  220.  
  221.  
  222.  
  223. S_API_UNSAFE /* ISteamClient009*/ void* STEAM_CALL
  224.     SteamClient()
  225. {
  226.     // 21
  227.     JUMP(21);
  228.     return NULL;
  229. }
  230.  
  231. S_API_UNSAFE /* ISteamContentServer002*/ void* STEAM_CALL
  232.     SteamContentServer()
  233. {
  234.     // 22
  235.     JUMP(22);
  236.     return NULL;
  237. }
  238.  
  239. S_API_UNSAFE /* ISteamUtils005*/ void* STEAM_CALL
  240.     SteamContentServerUtils()
  241. {
  242.     // 23
  243.     JUMP(23);
  244.     return NULL;
  245. }
  246.  
  247. S_API bool STEAM_CALL
  248.     SteamContentServer_Init(uint32_t unIP, uint16_t usPort)
  249. {
  250.     // 24
  251.     JUMP(24);
  252.     return 0;
  253. }
  254.  
  255. S_API void STEAM_CALL
  256.     SteamContentServer_RunCallbacks()
  257. {
  258.     // 25
  259.     JUMP(25);
  260. }
  261.  
  262. S_API_UNSAFE /* ISteamFriends005*/ void* STEAM_CALL
  263.     SteamFriends()
  264. {
  265.     // 26
  266.     JUMP(26);
  267.     return NULL;
  268. }
  269.  
  270.  
  271.  
  272. S_API_UNSAFE /* ISteamGameServer010*/ void* STEAM_CALL
  273.     SteamGameServer()
  274. {
  275.     // 27
  276.     JUMP(27);
  277.     return NULL;
  278. }
  279.  
  280. S_API_UNSAFE /* ISteamUtils005*/ void* STEAM_CALL
  281.     SteamGameServerUtils()
  282. {
  283.     // 28
  284.     JUMP(28);
  285.     return NULL;
  286. }
  287.  
  288. S_API_UNSAFE /* ISteamMasterServerUpdater001*/ void* STEAM_CALL
  289.     SteamMasterServerUpdater()
  290. {
  291.     // 29
  292.     JUMP(29);
  293.     return NULL;
  294. }
  295.  
  296. S_API_UNSAFE /* ISteamNetworking003*/ void* STEAM_CALL
  297.     SteamGameServerNetworking()
  298. {
  299.     // 30
  300.     JUMP(30);
  301.     return NULL;
  302. }
  303.  
  304. S_API_UNSAFE /* ISteamGameServerStats001*/ void* STEAM_CALL
  305.     SteamGameServerStats()
  306. {
  307.     // 31
  308.     JUMP(31);
  309.     return NULL;
  310. }
  311.  
  312.  
  313. S_API bool STEAM_CALL
  314.     SteamGameServer_BSecure()
  315. {
  316.     // 32
  317.     JUMP(32);
  318.     return 0;
  319. }
  320.  
  321. S_API HSteamPipe STEAM_CALL
  322.     SteamGameServer_GetHSteamPipe()
  323. {
  324.     // 33
  325.     JUMP(33);
  326.     return 0;
  327. }
  328.  
  329. S_API HSteamUser STEAM_CALL
  330.     SteamGameServer_GetHSteamUser()
  331. {
  332.     // 34
  333.     JUMP(34);
  334.     return 0;
  335. }
  336.  
  337. S_API int32_t STEAM_CALL
  338.     SteamGameServer_GetIPCCallCount()
  339. {
  340.     // 35
  341.     JUMP(35);
  342.     return 0;
  343. }
  344.  
  345. S_API uint64_t STEAM_CALL
  346.     SteamGameServer_GetSteamID()
  347. {
  348.     // 36
  349.     JUMP(36);
  350.     return 0;
  351. }
  352.  
  353. S_API bool STEAM_CALL
  354.     SteamGameServer_Init( uint32_t unIP, uint16_t usPort, uint16_t usGamePort, uint16_t usSpectatorPort, uint16_t usQueryPort, enum EServerMode eServerMode, const char *pchGameDir, const char *pchVersionString )
  355. {
  356.     // 37
  357.     JUMP(37);
  358.     return 0;
  359. }
  360.  
  361. S_API bool STEAM_CALL
  362.     SteamGameServer_InitSafe( uint32_t unIP, uint16_t usPort, uint16_t usGamePort, uint16_t usSpectatorPort, uint16_t usQueryPort, enum EServerMode eServerMode, const char *pchGameDir, const char *pchVersionString )
  363. {
  364.     // 38
  365.     JUMP(38);
  366.     return 0;
  367. }
  368.  
  369. S_API void STEAM_CALL
  370.     SteamGameServer_RunCallbacks()
  371. {
  372.     // 39
  373.     JUMP(39);
  374. }
  375.  
  376. S_API void STEAM_CALL
  377.     SteamContentServer_Shutdown()
  378. {
  379.     // 40
  380.     JUMP(40);
  381. }
  382.  
  383.  
  384. S_API_UNSAFE /* ISteamMatchmaking008*/ void* STEAM_CALL
  385.     SteamMatchmaking()
  386. {
  387.     // 41
  388.     JUMP(41);
  389.     return NULL;
  390. }
  391.  
  392. S_API_UNSAFE /* ISteamMatchmakingServers002*/ void* STEAM_CALL
  393.     SteamMatchmakingServers()
  394. {
  395.     // 42
  396.     JUMP(42);
  397.     return NULL;
  398. }
  399.  
  400. S_API_UNSAFE /* ISteamNetworking003*/ void* STEAM_CALL
  401.     SteamNetworking()
  402. {
  403.     // 43
  404.     JUMP(43);
  405.     return NULL;
  406. }
  407.  
  408. S_API_UNSAFE /*ISteamRemoteStorage002*/ void* STEAM_CALL
  409.     SteamRemoteStorage()
  410. {
  411.     // 44
  412.     JUMP(44);
  413.     return NULL;
  414. }
  415.  
  416. S_API_UNSAFE /* ISteamUser013*/ void* STEAM_CALL
  417.     SteamUser()
  418. {
  419.     // 45
  420.     JUMP(45);
  421.     return NULL;
  422. }
  423.  
  424. S_API_UNSAFE /*ISteamUserStats007*/ void* STEAM_CALL
  425.     SteamUserStats()
  426. {
  427.     // 46
  428.     JUMP(46);
  429.     return NULL;
  430. }
  431.  
  432.  
  433. S_API_UNSAFE /*ISteamUtils005*/ void* STEAM_CALL
  434.     SteamUtils()
  435. {
  436.     // 47
  437.     JUMP(47);
  438.     return NULL;
  439. }
  440.  
  441. S_API HSteamUser STEAM_CALL
  442.     Steam_GetHSteamUserCurrent()
  443. {
  444.     // 48
  445.     JUMP(48);
  446.     return 0;
  447. }
  448.  
  449. S_API void STEAM_CALL
  450.     Steam_RegisterInterfaceFuncs( void *hModule )
  451. {
  452.     // 49
  453.     JUMP(49);
  454. }
  455.  
  456. S_API void STEAM_CALL
  457.     Steam_RunCallbacks( HSteamPipe hSteamPipe, bool bGameServerCallbacks )
  458. {
  459.     // 50
  460.     JUMP(50);
  461. }
  462.  
  463. S_API /*ISteamClient009 */ void *g_pSteamClientGameServer; // ??
  464.  
  465. // SteamHTTP() - unknown // 51
  466. // SteamScreenshots - unknown // 52
  467.  
  468.  
  469. void * libsteam_api(void) {
  470.     void *h = dlopen("/home/geek/Steam/SteamApps/common/Trine 2/lib/lib32/libsteam_api.so", RTLD_NOW);
  471.     return h;
  472. }
  473.  
  474. void fill_table(void *lib) {
  475.     int i = 0;
  476.     for (i=0; i<53; i++) {
  477.     void *p = dlsym(lib,funcs[i].fName);
  478.     if (p) {
  479.         funcs[i].ptr = p;
  480.     } else {
  481.         TRACE("unknown symbol '%s' - leave stub\n", funcs[i].fName);
  482.     }
  483.     }
  484. }
  485.  
  486.  
  487. BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
  488. {
  489.     TRACE("(0x%p, %d, %p)\n", hinstDLL, fdwReason, lpvReserved);
  490.    
  491.     fill_table(libsteam_api());
  492.    
  493.     switch (fdwReason)
  494.     {
  495.         case DLL_WINE_PREATTACH:
  496.             return TRUE;    /* prefer native version */
  497.         case DLL_PROCESS_ATTACH:
  498.             DisableThreadLibraryCalls(hinstDLL);
  499.             break;
  500.         case DLL_PROCESS_DETACH:
  501.             break;
  502.     }
  503.  
  504.     return TRUE;
  505. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement