|
DllCall("VDRIVESDK.dll", "int", "VdriveUnmount", "int",0, "int" , "-1")
可以卸载掉VD的虚拟盘符!
DllCall("VDRIVESDK.dll", "int", "AddDriveLetter", "char", 'T' , "int" , "0")
但这段函数却出不了盘,特此上来请教各位!!
下面是一位高手发出的C++执行代码!请教转换为AU3代码!谢谢!
成功穿透VD,包括易游2006。采用的方法是调用VDRIVESDK.dll中的VdvireQuery、VdirveMount和VdriveUnmount函数。VD的UP.exe、易游2006的stsUG.exe也是调用这三个函数实现更新的。
另外它们也采用了DosDefineDevice让其出现所谓的S盘。
有关函数,见附件
#ifdef BUILD_DLL
#define IMPORT_EXPORT __declspec(dllexport)
#else
#define IMPORT_EXPORT __declspec(dllimport)
#endif
#ifdef __cplusplus
extern "C" {
#endif
IMPORT_EXPORT int __stdcall VdriveQuery(int, char *);
IMPORT_EXPORT int __stdcall VdriveUnmount(int, int);
IMPORT_EXPORT int __stdcall VdriveMount(char *, int);
IMPORT_EXPORT int __stdcall AddDriveLetter(char, int);
IMPORT_EXPORT int __stdcall RemoveDriveLetter(char);
IMPORT_EXPORT int __stdcall RegService(char *, char *, char *, char *);
IMPORT_EXPORT int __stdcall UnregService(int, int, int, int );
#ifdef __cplusplus
}
#endif
在C++Builder下,增加一个按纽,输入下列代码:
LPVOID lpMsgBuf; int t = 1; t = AddDriveLetter('T', 0); FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, t, 0, // Default language (LPTSTR) &lpMsgBuf, 0, NULL ); Application->MessageBoxA((const char *)lpMsgBuf,"提示",MB_OK); LocalFree(lpMsgBuf); if(t == 0) Application->MessageBoxA("AddDriveLetter成功", "提示", MB_OK); 运行后,即可在我的电脑中出现T盘。
注意一定要在安装了易游2006后运行。其它类似的环境没有测试。
以下代码是VdirveQuery()函数的用法:
void __fastcall TForm1::Button1Click(TObject *Sender) { LPVOID lpMsgBuf; char strPath[MAX_PATH]; int t = 0; t = VdriveQuery(0, vdrive); FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, t, 0, // Default language (LPTSTR) &lpMsgBuf, 0, NULL ); Application->MessageBoxA((const char *)lpMsgBuf,"提示",MB_OK); LocalFree(lpMsgBuf); t = 0; strPath[0] = vdrive[0]; strPath[1] = ':'; strPath[2] = 0; t = DefineDosDevice(DDD_RAW_TARGET_PATH, strPath, "\\device\\harddiskvolume2"); if(t != 0) Application->MessageBoxA("DefineDosDevice成功","提示",MB_OK);
}
以下是头文件Unit1.h的内容:
#ifndef Unit1H #define Unit1H //--------------------------------------------------------------------------- #include <Classes.hpp> #include <Controls.hpp> #include <StdCtrls.hpp> #include <Forms.hpp> //--------------------------------------------------------------------------- class TForm1 : public TForm { __published: // IDE-managed Components TButton *Button1; TButton *Button2; TButton *Button3; TButton *Button4; TButton *Button5; TButton *Button6; TButton *Button7; void __fastcall Button1Click(TObject *Sender); void __fastcall Button2Click(TObject *Sender); void __fastcall Button3Click(TObject *Sender); void __fastcall Button4Click(TObject *Sender); void __fastcall Button5Click(TObject *Sender); void __fastcall Button6Click(TObject *Sender); void __fastcall Button7Click(TObject *Sender); private: // User declarations public: // User declarations __fastcall TForm1(TComponent* Owner); char vdrive[424]; }; //--------------------------------------------------------------------------- extern PACKAGE TForm1 *Form1; //--------------------------------------------------------------------------- #endif
输入以下代码,可以移走添加的驱动器: LPVOID lpMsgBuf; int t = 1; t = RemoveDriveLetter('T'); FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, t, 0, // Default language (LPTSTR) &lpMsgBuf, 0, NULL ); Application->MessageBoxA((const char *)lpMsgBuf,"提示",MB_OK); LocalFree(lpMsgBuf); if(t == 0) Application->MessageBoxA("RemoveDriveLetter成功", "提示", MB_OK);
RegService()函数的调用方法:
LPVOID lpMsgBuf; int t = 1; t = RegService("P1","P2","P3","P4"); FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, t, 0, // Default language (LPTSTR) &lpMsgBuf, 0, NULL ); Application->MessageBoxA((const char *)lpMsgBuf,"提示",MB_OK); LocalFree(lpMsgBuf); if(t == 0) Application->MessageBoxA("RegService成功", "提示", MB_OK);
UnregService()函数的调用方法:
LPVOID lpMsgBuf;
int t = 1;
t = UnregService(0, 0, 0, 0);
FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
t,
0, // Default language
(LPTSTR) &lpMsgBuf,
0,
NULL
);
Application->MessageBoxA((const char *)lpMsgBuf,"提示",MB_OK);
LocalFree(lpMsgBuf);
if(t == 0) Application->MessageBoxA("UnregService成功", "提示", MB_OK);
以下是VdriveUnmount()函数的调用方法:
LPVOID lpMsgBuf;
int t = 0;
t = VdriveUnmount(0, -1);
FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
t,
0, // Default language
(LPTSTR) &lpMsgBuf,
0,
NULL
);
Application->MessageBoxA((const char *)lpMsgBuf,"提示",MB_OK);
LocalFree(lpMsgBuf);
以下是Vdrivemount()函数的调用方法:
LPVOID lpMsgBuf;
char strPath[MAX_PATH];
int t = 0;
t = VdriveMount(vdrive,0);
FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
t,
0, // Default language
(LPTSTR) &lpMsgBuf,
0,
NULL
);
Application->MessageBoxA((const char *)lpMsgBuf,"提示",MB_OK);
LocalFree(lpMsgBuf);
t = 0;
strPath[0] = vdrive[0];
strPath[1] = ':';
strPath[2] = 0;
t = DefineDosDevice(DDD_REMOVE_DEFINITION, strPath, NULL);
if(t != 0) Application->MessageBoxA("DefineDosDevice成功", "提示", MB_OK); |
|