Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > General Coding
You last visited: Today at 04:04

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



dll exports...

Discussion on dll exports... within the General Coding forum part of the Coders Den category.

Reply
 
Old   #1
 
Tyrar's Avatar
 
elite*gold: 0
Join Date: Oct 2008
Posts: 1,637
Received Thanks: 1,119
dll exports...

hi, hab grad ein problem mit den exports...
original:

meine:


wieso wird meine func iwie umbenannt?
hier ma der code:
Code:
int __declspec(dllexport) __stdcall Py_SetProgramName()
{
    static FARPROC Py_SetProgramNameOrig = 0;
    int result; // Für das Resultat des Aufrufes der Originalfunktion
    if (Py_SetProgramNameOrig == 0) { // Original-Funktion finden
        Py_SetProgramNameOrig = GetProcAddress(lib, "Py_SetProgramName");
    }

    result = Py_SetProgramNameOrig();

    return result;
}
Tyrar is offline  
Old 02/04/2009, 21:15   #2
 
Tyrar's Avatar
 
elite*gold: 0
Join Date: Oct 2008
Posts: 1,637
Received Thanks: 1,119
sry für doppelpost
problem gelöst: lag iwie an meiner ide!

nächstes prob:
ich bekomme ne meldung dass in meiner dll kein einsprungpunkt für die funktion is, aber exports sind drin
Tyrar is offline  
Old 02/04/2009, 21:33   #3
 
elite*gold: 0
Join Date: Nov 2008
Posts: 576
Received Thanks: 191
hast du eine library datei erstellt mit den zu exportierenden funktionen?
__wadim is offline  
Old 02/04/2009, 21:37   #4
 
Tyrar's Avatar
 
elite*gold: 0
Join Date: Oct 2008
Posts: 1,637
Received Thanks: 1,119
Quote:
Originally Posted by __wadim View Post
hast du eine library datei erstellt mit den zu exportierenden funktionen?
jo, spiel disassembliert, nötigen funktionen rausgesucht, in meine dll gepackt, exportiert, in den spielordner eingefügt, fehler bekommen.
hab hier ne grobe übersicht:
Code:
int __declspec(dllexport) __stdcall Py_SetProgramName() { return 0; }                                   
int __declspec(dllexport) __stdcall PyImport_AddModule() { return 0; }                                   
int __declspec(dllexport) __stdcall PyModule_GetDict() { return 0; }                                     
int __declspec(dllexport) __stdcall PyImport_ImportModule() { return 0; }                                
int __declspec(dllexport) __stdcall PyDict_SetItemString() { return 0; }                                 
int __declspec(dllexport) __stdcall PyRun_String() { return 0; }                                         
int __declspec(dllexport) __stdcall Py_Initialize() { return 0; }                                        
int __declspec(dllexport) __stdcall PyErr_Fetch() { return 0; }                                          
int __declspec(dllexport) __stdcall PyNumber_Check() { return 0; }                                       
int __declspec(dllexport) __stdcall PyObject_GetAttr() { return 0; }                                     
int __declspec(dllexport) __stdcall PyObject_GetAttrString() { return 0; }                               
int __declspec(dllexport) __stdcall PyErr_Clear() { return 0; }                                          
int __declspec(dllexport) __stdcall PyCallable_Check() { return 0; }                                     
int __declspec(dllexport) __stdcall PyObject_CallObject() { return 0; }                                  
int __declspec(dllexport) __stdcall PyErr_Print() { return 0; }                                          
int __declspec(dllexport) __stdcall PyString_Type() { return 0; }                                        
int __declspec(dllexport) __stdcall PyString_AsString() { return 0; }                                    
int __declspec(dllexport) __stdcall PyFloat_AsDouble() { return 0; }                                     
int __declspec(dllexport) __stdcall _Py_NoneStruct() { return 0; }                                       
int __declspec(dllexport) __stdcall PyErr_BadArgument() { return 0; }                                    
int __declspec(dllexport) __stdcall PyList_New() { return 0; }                                           
int __declspec(dllexport) __stdcall PyString_FromString() { return 0; }                                  
int __declspec(dllexport) __stdcall PyList_Append() { return 0; }                                        
int __declspec(dllexport) __stdcall PyTuple_Type() { return 0; }                                         
int __declspec(dllexport) __stdcall PyInt_AsLong() { return 0; }                                        
int __declspec(dllexport) __stdcall PyString_InternFromString() { return 0; }                            
int __declspec(dllexport) __stdcall Py_Finalize() { return 0; }                                          
int __declspec(dllexport) __stdcall PyExc_RuntimeError() { return 0; }                                   
int __declspec(dllexport) __stdcall PyErr_SetString() { return 0; }                                      
int __declspec(dllexport) __stdcall PyTuple_GetItem() { return 0; }                                      
int __declspec(dllexport) __stdcall PyDict_Type() { return 0; }                                          
int __declspec(dllexport) __stdcall PyType_IsSubtype() { return 0; }                                     
int __declspec(dllexport) __stdcall PyDict_GetItemString() { return 0; }                                 
int __declspec(dllexport) __stdcall PyLong_AsLong() { return 0; }                                        
int __declspec(dllexport) __stdcall PyTuple_Size() { return 0; }                                         
int __declspec(dllexport) __stdcall Py_InitModule4() { return 0; }                                       
int __declspec(dllexport) __stdcall PyModule_AddIntConstant() { return 0; }                              
int __declspec(dllexport) __stdcall Py_BuildValue() { return 0; }
und mein def file sieht so aus:
Code:
LIBRARY"python22"
EXPORTS
Py_SetProgramName @ 1;
PyImport_AddModule @ 2;
PyModule_GetDict @ 3;
PyImport_ImportModule @ 4;
PyDict_SetItemString @ 5;
PyRun_String @ 6;
Py_Initialize @ 7;
PyErr_Fetch @ 8;
PyNumber_Check @ 9;
PyObject_GetAttr @ 10;
PyObject_GetAttrString @ 11;
PyErr_Clear @ 12;
PyCallable_Check @ 13;
PyObject_CallObject @ 14;
PyErr_Print @ 15;
PyString_Type @ 16;
PyString_AsString @ 17;
PyFloat_AsDouble @ 18;
_Py_NoneStruct @ 19;
PyErr_BadArgument @ 20;
PyList_New @ 21;
PyString_FromString @ 22;
PyList_Append @ 23;
PyTuple_Type @ 24;
PyInt_AsLong @ 25;
PyString_InternFromString @ 26;
Py_Finalize @ 27;
PyExc_RuntimeError @ 28;
PyErr_SetString @ 29;
PyTuple_GetItem @ 30;
PyDict_Type @ 31;
PyType_IsSubtype @ 32;
PyDict_GetItemString @ 33;
PyLong_AsLong @ 34;
PyTuple_Size @ 35;
Py_InitModule4 @ 36;
PyModule_AddIntConstant @ 37;
Py_BuildValue @ 38;
beim disassemblieren sind alle funktionen drin!
hier mal die dll:
Tyrar is offline  
Old 02/06/2009, 04:49   #5
 
elite*gold: 0
Join Date: May 2008
Posts: 489
Received Thanks: 210
Dein erstes Problem lässt sich mit einer Definition der Funktionen in einem extern "C" Block lösen.

Das zweite Problem klingt, als hättest du keine DllMain definiert.
schlurmann is offline  
Old 02/06/2009, 11:57   #6
 
Tyrar's Avatar
 
elite*gold: 0
Join Date: Oct 2008
Posts: 1,637
Received Thanks: 1,119
Quote:
Originally Posted by schlurmann View Post
Dein erstes Problem lässt sich mit einer Definition der Funktionen in einem extern "C" Block lösen.

Das zweite Problem klingt, als hättest du keine DllMain definiert.
exports.h (wird eingebunden):
Code:
#define WIN32_LEAN_AND_MEAN
#include <windows.h>

extern "C"
{
int __declspec(dllexport) __stdcall Py_SetProgramName();                       
int __declspec(dllexport) __stdcall PyImport_AddModule();                       
int __declspec(dllexport) __stdcall PyModule_GetDict();                                
int __declspec(dllexport) __stdcall PyImport_ImportModule();                       
int __declspec(dllexport) __stdcall PyDict_SetItemString();                   
int __declspec(dllexport) __stdcall PyRun_String();                            
int __declspec(dllexport) __stdcall Py_Initialize();                           
int __declspec(dllexport) __stdcall PyErr_Fetch();                              
int __declspec(dllexport) __stdcall PyNumber_Check();                                      
int __declspec(dllexport) __stdcall PyObject_GetAttr();                                  
int __declspec(dllexport) __stdcall PyObject_GetAttrString();                          
int __declspec(dllexport) __stdcall PyErr_Clear();                                      
int __declspec(dllexport) __stdcall PyCallable_Check();                               
int __declspec(dllexport) __stdcall PyObject_CallObject();                        
int __declspec(dllexport) __stdcall PyErr_Print();                                 
int __declspec(dllexport) __stdcall PyString_Type();                                   
int __declspec(dllexport) __stdcall PyString_AsString();                        
int __declspec(dllexport) __stdcall PyFloat_AsDouble();                            
int __declspec(dllexport) __stdcall _Py_NoneStruct();                                
int __declspec(dllexport) __stdcall PyErr_BadArgument();                           
int __declspec(dllexport) __stdcall PyList_New();                                
int __declspec(dllexport) __stdcall PyString_FromString();                                
int __declspec(dllexport) __stdcall PyList_Append();                                    
int __declspec(dllexport) __stdcall PyTuple_Type();                                       
int __declspec(dllexport) __stdcall PyInt_AsLong();                                      
int __declspec(dllexport) __stdcall PyString_InternFromString();                          
int __declspec(dllexport) __stdcall Py_Finalize();
int __declspec(dllexport) __stdcall PyExc_RuntimeError();                           
int __declspec(dllexport) __stdcall PyErr_SetString();                                
int __declspec(dllexport) __stdcall PyTuple_GetItem();                                   
int __declspec(dllexport) __stdcall PyDict_Type();                                  
int __declspec(dllexport) __stdcall PyType_IsSubtype();                            
int __declspec(dllexport) __stdcall PyDict_GetItemString();                        
int __declspec(dllexport) __stdcall PyLong_AsLong();                           
int __declspec(dllexport) __stdcall PyTuple_Size();                                  
int __declspec(dllexport) __stdcall Py_InitModule4();                                      
int __declspec(dllexport) __stdcall PyModule_AddIntConstant();                            
int __declspec(dllexport) __stdcall Py_BuildValue();      
};
python22.cpp:
Code:
#include "stdafx.h"
#include "exports.h"


/*****************************************************
************ Liste der nötigen Exports ***************
******************************************************
------------------------------------------------------
++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++++ ITEMS: 38 ++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++++++
----------------------------------------------------*/
extern "C"
{
int __declspec(dllexport) __stdcall Py_SetProgramName() { return 0; }                                   
int __declspec(dllexport) __stdcall PyImport_AddModule() { return 0; }                                   
int __declspec(dllexport) __stdcall PyModule_GetDict() { return 0; }                                     
int __declspec(dllexport) __stdcall PyImport_ImportModule() { return 0; }                                
int __declspec(dllexport) __stdcall PyDict_SetItemString() { return 0; }                                 
int __declspec(dllexport) __stdcall PyRun_String() { return 0; }                                         
int __declspec(dllexport) __stdcall Py_Initialize() { return 0; }                                        
int __declspec(dllexport) __stdcall PyErr_Fetch() { return 0; }                                          
int __declspec(dllexport) __stdcall PyNumber_Check() { return 0; }                                       
int __declspec(dllexport) __stdcall PyObject_GetAttr() { return 0; }                                     
int __declspec(dllexport) __stdcall PyObject_GetAttrString() { return 0; }                               
int __declspec(dllexport) __stdcall PyErr_Clear() { return 0; }                                          
int __declspec(dllexport) __stdcall PyCallable_Check() { return 0; }                                     
int __declspec(dllexport) __stdcall PyObject_CallObject() { return 0; }                                  
int __declspec(dllexport) __stdcall PyErr_Print() { return 0; }                                          
int __declspec(dllexport) __stdcall PyString_Type() { return 0; }                                        
int __declspec(dllexport) __stdcall PyString_AsString() { return 0; }                                    
int __declspec(dllexport) __stdcall PyFloat_AsDouble() { return 0; }                                     
int __declspec(dllexport) __stdcall _Py_NoneStruct() { return 0; }                                       
int __declspec(dllexport) __stdcall PyErr_BadArgument() { return 0; }                                    
int __declspec(dllexport) __stdcall PyList_New() { return 0; }                                           
int __declspec(dllexport) __stdcall PyString_FromString() { return 0; }                                  
int __declspec(dllexport) __stdcall PyList_Append() { return 0; }                                        
int __declspec(dllexport) __stdcall PyTuple_Type() { return 0; }                                         
int __declspec(dllexport) __stdcall PyInt_AsLong() { return 0; }                                        
int __declspec(dllexport) __stdcall PyString_InternFromString() { return 0; }                            
int __declspec(dllexport) __stdcall Py_Finalize() { return 0; }                                          
int __declspec(dllexport) __stdcall PyExc_RuntimeError() { return 0; }                                   
int __declspec(dllexport) __stdcall PyErr_SetString() { return 0; }                                      
int __declspec(dllexport) __stdcall PyTuple_GetItem() { return 0; }                                      
int __declspec(dllexport) __stdcall PyDict_Type() { return 0; }                                          
int __declspec(dllexport) __stdcall PyType_IsSubtype() { return 0; }                                     
int __declspec(dllexport) __stdcall PyDict_GetItemString() { return 0; }                                 
int __declspec(dllexport) __stdcall PyLong_AsLong() { return 0; }                                        
int __declspec(dllexport) __stdcall PyTuple_Size() { return 0; }                                         
int __declspec(dllexport) __stdcall Py_InitModule4() { return 0; }                                       
int __declspec(dllexport) __stdcall PyModule_AddIntConstant() { return 0; }                              
int __declspec(dllexport) __stdcall Py_BuildValue() { return 0; }                                        
}
dllmain.cpp:
Code:
#include "stdafx.h"
#include "exports.h"
#include "windows.h"
#include "dll.h"

#ifdef _MANAGED
#pragma managed(push, off)
#endif

HMODULE lib = 0;

BOOL APIENTRY DllMain( HMODULE hModule,
                       DWORD  ul_reason_for_call,
                       LPVOID lpReserved
					 )
{ 
   switch ( ul_reason_for_call ) {
    case DLL_PROCESS_ATTACH:
      lib = LoadLibraryA("python22_original.dll");
      // MAIN THREAD!!!
      break;
    case DLL_PROCESS_DETACH:
      FreeLibrary(lib);
      break;
  }
  return TRUE;
}


#ifdef _MANAGED
#pragma managed(pop)
#endif
Tyrar is offline  
Reply


Similar Threads Similar Threads
So that could support Chinese exports of Coemu?
07/24/2009 - CO2 Private Server - 0 Replies
So that could support Chinese exports of Coemu?:confused: How should I do?



All times are GMT +1. The time now is 04:05.


Powered by vBulletin®
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2026 elitepvpers All Rights Reserved.