cdvdgigaherz: Move dllmain to a Windows only file

This commit is contained in:
Jonathan Li 2016-10-24 23:49:59 +01:00
parent d7866831ae
commit b1850f2465
3 changed files with 11 additions and 17 deletions

View File

@ -61,20 +61,6 @@ const unsigned char version = PS2E_CDVD_VERSION;
const unsigned char revision = 0;
const unsigned char build = 10;
HINSTANCE hinst;
BOOL WINAPI DllMain(
HINSTANCE hinstDLL, // handle to DLL module
DWORD fdwReason, // reason for calling function
LPVOID lpvReserved // reserved
)
{
if (fdwReason == DLL_PROCESS_ATTACH) {
hinst = hinstDLL;
}
return TRUE;
}
char *CALLBACK PS2EgetLibName()
{
return LibName;

View File

@ -87,8 +87,6 @@ extern IOCtlSrc *src;
void configure();
extern HINSTANCE hinst;
void ReadSettings();
void WriteSettings();
std::wstring GetValidDrive();

View File

@ -22,6 +22,16 @@
#include <codecvt>
#include "resource.h"
static HINSTANCE s_hinstance;
BOOL WINAPI DllMain(HINSTANCE hinstance, DWORD reason, LPVOID reserved)
{
if (reason == DLL_PROCESS_ATTACH)
s_hinstance = hinstance;
return TRUE;
}
static INT_PTR CALLBACK ConfigProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch (uMsg) {
@ -111,6 +121,6 @@ void configure()
{
ReadSettings();
auto drives = GetOpticalDriveList();
DialogBoxParam(hinst, MAKEINTRESOURCE(IDD_CONFIG), GetActiveWindow(),
DialogBoxParam(s_hinstance, MAKEINTRESOURCE(IDD_CONFIG), GetActiveWindow(),
ConfigProc, reinterpret_cast<LPARAM>(&drives));
}