| |
| Posted by Lloyd Dupont | PermalinkReply |
|
Lloyd Dupont
| I have a simple program with 2 files registry.d, regdump.d (see below) and
when I try
to compile it I always get thiw error message:
# ---------------------------
C:\D\dev\lloyd\reg>dmd -o a.exe regdump.d registry.d && a
Assertion failure: '0' on line 232 in file 'module.c'
abnormal program termination
# -------- registry.d --------
module lloyd.registry;
import windows;
import string;
extern (Windows)
{
export LONG RegOpenKeyExA(HKEY,LPCSTR,DWORD,REGSAM,PHKEY);
export LONG RegOpenKeyExW(HKEY,LPCWSTR,DWORD,REGSAM,PHKEY);
}
LONG RegOpenKeyEx(HKEY hKey, char[] lpSubKey, DWORD ulOptions, REGSAM
samDesired, PHKEY phkResult)
{
return RegOpenKeyExA(hKey, lpSubKey, ulOptions, samDesired, phkResult);
}
# ------- regdump.d -------
import windows, registry;
import string;
import lloyd.registry;
char[] tostring(char* cstring)
{
int n = strlen(cstring);
return cstring[0 .. n];
}
void dump(HKEY root, char[] subkey)
{
HKEY rKey;
LONG ret = RegOpenKeyEx(
root,
subkey,
0,
KEY_READ,
&rKey);
assert(ret == ERROR_SUCCESS);
try {
}
finally { RegCloseKey(rKey); }
}
// dmd -o a.exe regdump.d registry.d && a
int main(char[][] args)
{
dump(HKEY_LOCAL_MACHINE, 'Software\7-ZIP');
return 0;
}
# ---------------------------
|