- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sorry for posting a second time. The spell checker sort of wacked my first post...
I'm trying to read a string from the registry to implement design-time licensing in a COM DLL, which I've written in Fortran 6.5. I can successfully open the registry key, but when I try to read the REG_SZ value via RegQueryValueEx PI function, I get the following first-chance exception:
First-chance exception in OlisGW.exe (ADVAPI32.DLL): 0xC0000005: Access Violation.
I've used this same sort of licensing technique from I++ COM DLLs written in ATL, so I know the process works. Can anyone shed light on my problem? The code I am using is listed below.
Thanks,
Michael Gerfen
I'm trying to read a string from the registry to implement design-time licensing in a COM DLL, which I've written in Fortran 6.5. I can successfully open the registry key, but when I try to read the REG_SZ value via RegQueryValueEx PI function, I get the following first-chance exception:
First-chance exception in OlisGW.exe (ADVAPI32.DLL): 0xC0000005: Access Violation.
I've used this same sort of licensing technique from I++ COM DLLs written in ATL, so I know the process works. Can anyone shed light on my problem? The code I am using is listed below.
Thanks,
Michael Gerfen
! ! CanRequestLicenseKey ! function CanRequestLicenseKey result use dfwin implicit none logical r ! TODO: Add code to determine if the class is design-time licensed ! on this machine and we can return the license key in a ! call to GetLicenseKey integer(INT_PTR_KIND()) bstrKey integer(INT_PTR_KIND()) bstrLicense integer(LONG) hresult integer(LONG) retval integer(LONG) iLen character(1024) license integer hKey iLen = 1024 if ( RegOpenKeyEx(HKEY_CURRENT_USER, Key, 0, & KEY_QUERY_VALUE , loc(hKey) ) == ERROR_SUCCESS) then !this line causes the first-chance exception retval = RegQueryValueEx( hKey, "Fortran License"C, NULL, 1, loc(license), loc(iLen) ) bstrLicense = ConvertStringToBSTR(license) hresult = GetLicenseKey(bstrKey) if (bstrLicense .EQ. bstrKey) Then r = .TRUE. else r = .FALSE. end if end if end function
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The fourth parameter to RegQueryValueEx is an out parameter. Pass either NULL or loc(somevar).
hth,
John
hth,
John
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
John,
Doh! Thanks, that did the trick.
Regards,
Michael
Doh! Thanks, that did the trick.
Regards,
Michael

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page