1 |
|
/* |
2 |
|
* util_windows.cpp - Miscellaneous utilities for Win32 |
3 |
|
* |
4 |
< |
* Basilisk II (C) 1997-2004 Christian Bauer |
4 |
> |
* Basilisk II (C) 1997-2005 Christian Bauer |
5 |
|
* |
6 |
|
* Windows platform specific code copyright (C) Lauri Pesonen |
7 |
|
* |
22 |
|
|
23 |
|
#include "sysdeps.h" |
24 |
|
#include "util_windows.h" |
25 |
+ |
#include "main.h" |
26 |
|
|
27 |
|
BOOL exists( const char *path ) |
28 |
|
{ |
84 |
|
} |
85 |
|
return(size); |
86 |
|
} |
87 |
+ |
|
88 |
+ |
|
89 |
+ |
/* |
90 |
+ |
* Thread wrappers |
91 |
+ |
*/ |
92 |
+ |
|
93 |
+ |
HANDLE create_thread(LPTHREAD_START_ROUTINE start_routine, void *arg) |
94 |
+ |
{ |
95 |
+ |
DWORD dwThreadId; |
96 |
+ |
return CreateThread(NULL, 0, start_routine, arg, 0, &dwThreadId); |
97 |
+ |
} |
98 |
+ |
|
99 |
+ |
void wait_thread(HANDLE thread) |
100 |
+ |
{ |
101 |
+ |
WaitForSingleObject(thread, INFINITE); |
102 |
+ |
CloseHandle(thread); |
103 |
+ |
} |
104 |
+ |
|
105 |
+ |
void kill_thread(HANDLE thread) |
106 |
+ |
{ |
107 |
+ |
TerminateThread(thread, 0); |
108 |
+ |
} |
109 |
+ |
|
110 |
+ |
|
111 |
+ |
/* |
112 |
+ |
* Check that drivers are installed |
113 |
+ |
*/ |
114 |
+ |
|
115 |
+ |
bool check_drivers(void) |
116 |
+ |
{ |
117 |
+ |
char path[_MAX_PATH]; |
118 |
+ |
GetSystemDirectory(path, sizeof(path)); |
119 |
+ |
strcat(path, "\\drivers\\cdenable.sys"); |
120 |
+ |
|
121 |
+ |
if (exists(path)) { |
122 |
+ |
int32 size = get_file_size(path); |
123 |
+ |
if (size != 6112) { |
124 |
+ |
char str[256]; |
125 |
+ |
sprintf(str, "The CD-ROM driver file \"%s\" is too old or corrupted.", path); |
126 |
+ |
ErrorAlert(str); |
127 |
+ |
return false; |
128 |
+ |
} |
129 |
+ |
} |
130 |
+ |
else { |
131 |
+ |
char str[256]; |
132 |
+ |
sprintf(str, "The CD-ROM driver file \"%s\" is missing.", path); |
133 |
+ |
WarningAlert(str); |
134 |
+ |
} |
135 |
+ |
|
136 |
+ |
return true; |
137 |
+ |
} |