PCDVD數位科技討論區

PCDVD數位科技討論區 (https://www.pcdvd.com.tw/index.php)
-   七嘴八舌異言堂 (https://www.pcdvd.com.tw/forumdisplay.php?f=12)
-   -   救命,修改DLL檔,改不出來就要滾蛋了! (https://www.pcdvd.com.tw/showthread.php?t=305379)

waywaylee 2004-02-23 07:11 PM

救命,修改DLL檔,改不出來就要滾蛋了!
 
小弟奉老闆之命要修改一dll檔,此檔可在WIN98上供VB執行無誤,但WIN2000及XP則不行,經修改之後還是不行,小弟才疏學淺,望站上各位大大幫忙想想辦法修改,或提供相關論壇之連結,如蒙大德幫助,小地自當登門拜謝,喝杯茶,吃口包子囉,缸溫啦!

98下可執行:

#include <afxwin.h>
#include <conio.h>
#include "p1.h"

extern "C"
int PASCAL EXPORT RP(int p_add)
{
return _inp(p_add);
// for(int p2=0; p2<10; p2++);
}
/////////////////////////////////////////////////////////////////
extern "C"
void PASCAL EXPORT WP(int p_add, int data)
{
_outp(p_add, data);
// for(int p2=0; p2<180000; p2++);

}

--------我是分格線--------------------------------

//header file

extern "C" {
int PASCAL EXPORT RP(int p_add);
}

extern "C" {
void PASCAL EXPORT WP(int p_add, int data);
}

--------我是分格線--------------------------------


修改後


#include <afxwin.h>
#include <conio.h>
#include "p1.h"
////////////////////////////////////////////////////////
class CDynamDLL : public CWinApp
{
public:
virtual BOOL InitInstance();
virtual int ExitInstance();

CDynamDLL(LPCTSTR pszAppName):CWinApp(pszAppName){}
};

//DEL BOOL CDynamDLL::InitInstance()
//DEL {
//DEL
//DEL SetDialogBkColor();
//DEL return TRUE;
//DEL }

//DEL int CDynamDLL::ExitInstance()
//DEL {
//DEL return CWinApp::ExitInstance();
//DEL }

extern "C"
void PASCAL EXPORT WP(int x, int y)
{
_outp(x, y);
for(int p=0; p<180000; p++);
}

extern "C"
int PASCAL EXPORT RP(int add)
{
return _inp(add);
// for(int 02=0; p2<180000; p2++);

}

--------我是分格線--------------------------------

<p1.h>


extern "C" {
void PASCAL EXPORT WP(int x, int y);
}

extern "C" {
int PASCAL EXPORT RP(int add);

}


--------我是分格線------------------------------------


謝謝大家幫忙

oldton 2004-02-23 09:47 PM

問題出在_inp,_outp~
windows NT/2000/XP不能在user mode直接讀寫I/O port
你應該是有個外面的硬體吧~
寫個driver吧

必吉 2004-02-24 12:38 AM

這似乎要用到WDM驅動程式....

Jeff-h 2004-02-24 12:23 PM

藍色小舖有很多大大可以幫忙
你可以去那裡問
網址請用google找


所有的時間均為GMT +8。 現在的時間是02:02 PM.

vBulletin Version 3.0.1
powered_by_vbulletin 2025。