mirror of
https://github.com/kanjitalk755/macemu.git
synced 2024-11-27 02:49:42 +00:00
Check that drivers are installed (e.g. CD-ROM driver)
This commit is contained in:
parent
143b18c752
commit
7b6d062c9d
@ -48,6 +48,7 @@ using std::string;
|
||||
#include "main.h"
|
||||
#include "vm_alloc.h"
|
||||
#include "sigsegv.h"
|
||||
#include "util_windows.h"
|
||||
#include "kernel_windows.h"
|
||||
|
||||
#if USE_JIT
|
||||
@ -297,6 +298,10 @@ int main(int argc, char **argv)
|
||||
QuitEmulator();
|
||||
}
|
||||
|
||||
// Check that drivers are installed
|
||||
if (!check_drivers())
|
||||
QuitEmulator();
|
||||
|
||||
// Load win32 libraries
|
||||
KernelInit();
|
||||
|
||||
|
@ -22,6 +22,7 @@
|
||||
|
||||
#include "sysdeps.h"
|
||||
#include "util_windows.h"
|
||||
#include "main.h"
|
||||
|
||||
BOOL exists( const char *path )
|
||||
{
|
||||
@ -105,3 +106,32 @@ void kill_thread(HANDLE thread)
|
||||
{
|
||||
TerminateThread(thread, 0);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Check that drivers are installed
|
||||
*/
|
||||
|
||||
bool check_drivers(void)
|
||||
{
|
||||
char path[_MAX_PATH];
|
||||
GetSystemDirectory(path, sizeof(path));
|
||||
strcat(path, "\\drivers\\cdenable.sys");
|
||||
|
||||
if (exists(path)) {
|
||||
int32 size = get_file_size(path);
|
||||
if (size != 6112) {
|
||||
char str[256];
|
||||
sprintf(str, "The CD-ROM driver file \"%s\" is too old or corrupted.", path);
|
||||
ErrorAlert(str);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
char str[256];
|
||||
sprintf(str, "The CD-ROM driver file \"%s\" is missing.", path);
|
||||
WarningAlert(str);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -26,6 +26,7 @@
|
||||
BOOL exists( const char *path );
|
||||
int32 get_file_size( const char *path );
|
||||
BOOL create_file( const char *path, DWORD size );
|
||||
bool check_drivers(void);
|
||||
|
||||
// Thread wrappers
|
||||
extern HANDLE create_thread(LPTHREAD_START_ROUTINE start_routine, void *arg = NULL);
|
||||
|
Loading…
Reference in New Issue
Block a user