Check that drivers are installed (e.g. CD-ROM driver)

This commit is contained in:
gbeauche 2005-03-19 19:01:49 +00:00
parent 143b18c752
commit 7b6d062c9d
3 changed files with 36 additions and 0 deletions

View File

@ -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();

View File

@ -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;
}

View File

@ -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);