-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathchkreg.c
More file actions
executable file
·100 lines (94 loc) · 2.78 KB
/
Copy pathchkreg.c
File metadata and controls
executable file
·100 lines (94 loc) · 2.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
/* chkreg.c - registry card information */
#include <stdio.h>
#include <string.h>
#include <windows.h>
#include "cardinfo.h"
#define round(x) ((int)((x)+0.5))
void sio_set_cardinfo(CARDINFO, int);
CARDINFO sio_get_cardinfo(int);
/* chkreg - check registry for card information */
void
check_registry()
{
char key_name[80], card_name[MAX_CT_NAME];
int i, j;
long n, r, t, temp;
CARDINFO ci;
HKEY hKey;
sprintf(key_name,"SOFTWARE\\BTNRH\\SysRes\\CardTypes");
if(RegOpenKeyEx(HKEY_LOCAL_MACHINE, key_name, 0, KEY_QUERY_VALUE, &hKey)
!= ERROR_SUCCESS) {
return;
}
for (i = 0; i < NCT; i++) {
memset(&ci, 0, sizeof(ci));
sprintf(key_name,"SOFTWARE\\BTNRH\\SysRes\\CardTypes\\CardType%d", i);
if(RegOpenKeyEx(HKEY_LOCAL_MACHINE, key_name, 0, KEY_QUERY_VALUE, &hKey)
== ERROR_SUCCESS) {
n = MAX_CT_NAME;
t = REG_SZ;
r = RegQueryValueEx(hKey, "Name", NULL, &t, card_name, &n);
if (r == 0) {
strncpy(ci.name, card_name, MAX_CT_NAME);
} else {
continue;
}
n = sizeof(long);
t = REG_DWORD;
r = RegQueryValueEx(hKey, "bits", NULL, &t, (LPBYTE) &temp, &n);
if (r == 0) {
ci.bits = (int) temp;
}
r = RegQueryValueEx(hKey, "left", NULL, &t, (LPBYTE) &temp, &n);
if (r == 0) {
ci.left = (int) temp;
}
r = RegQueryValueEx(hKey, "nbps", NULL, &t, (LPBYTE) &temp, &n);
if (r == 0) {
ci.nbps = (int) temp;
}
r = RegQueryValueEx(hKey, "ncio", NULL, &t, (LPBYTE) &temp, &n);
if (r == 0) {
ci.ncad = ci.ncda = (int) temp;
}
r = RegQueryValueEx(hKey, "ncad", NULL, &t, (LPBYTE) &temp, &n);
if (r == 0) {
ci.ncad = (int) temp;
}
r = RegQueryValueEx(hKey, "ncda", NULL, &t, (LPBYTE) &temp, &n);
if (r == 0) {
ci.ncda = (int) temp;
}
r = RegQueryValueEx(hKey, "gdsr", NULL, &t, (LPBYTE) &temp, &n);
if (r == 0) {
ci.gdsr = (int) temp;
}
r = RegQueryValueEx(hKey, "ad_mv_fs", NULL, &t, (LPBYTE) &temp, &n);
if (r == 0) {
if (temp > 0)
for (j = 0; j < MAXNCH; j++)
ci.ad_vfs[j] = temp * 0.001;
}
r = RegQueryValueEx(hKey, "da_mv_fs", NULL, &t, (LPBYTE) &temp, &n);
if (r == 0) {
if (temp > 0)
for (j = 0; j < MAXNCH; j++)
ci.da_vfs[j] = temp * 0.001;
}
for (j = 0; j < MAXNCH; j++) {
sprintf(key_name, "ad%d_mv_fs", j + 1);
r = RegQueryValueEx(hKey, key_name, NULL, &t, (LPBYTE) &temp, &n);
if (r == 0) {
ci.ad_vfs[j] = temp * 0.001;
}
sprintf(key_name, "da%d_mv_fs", j + 1);
r = RegQueryValueEx(hKey, key_name, NULL, &t, (LPBYTE) &temp, &n);
if (r == 0) {
ci.da_vfs[j] = temp * 0.001;
}
}
RegCloseKey(hKey);
sio_set_cardinfo(ci, i);
}
}
}