views:

486

answers:

1

New one for you. Im getting ready to help another programmer port his program from C# to Delphi. I cant truly read C# nor has he sent me actual source at this point so from discussion i think im going to be tackling most of this from a one function at a time standpoint.

I need to be able to get the IO Port Numbers for all SATA devices (I believe i mean devices) connected to the system. I know WMI wont do it so im not sure where to start on this one. I know the C# version of this app uses a C# class that basically parses the registry. Ive always been icky about directly reading from the registry. I feel that getting the information from windows api or related is more reliable between windows versions if possible.

+1  A: 

If the original is reading the registry, and you are porting the function, reading the registry looks like a perfectly valid solution to me?

By the way, Delphi has the class TRegistry from the unit registry.pas. You can use that to read and write the registry. By default you are asking for all the rights (read/write..) on vista this can be a problem, so be sure to open readonly if you are planning to read only.

Key values:

KEY_READ
KEY_WRITE 
KEY_EXECUTE
KEY_ALL_ACCESS

These are actually sets made of the basic values:

KEY_QUERY_VALUE       
KEY_SET_VALUE         
KEY_CREATE_SUB_KEY    
KEY_ENUMERATE_SUB_KEYS
KEY_NOTIFY     
KEY_CREATE_LINK
KEY_WOW64_32KEY
KEY_WOW64_64KEY
KEY_WOW64_RES
Gamecat
You ask if its strange to port code i havent seen. To me no, ive functionally "ported" another one of his apps using my own code just by looking at how it works. I port programs with no source to pascal by using an external debugger as well. I do that for old command line apps that i need.
Brian Holloway
I also meant to say i shouldnt have too many issues with vista. Other apps that i write typically do low level things requiring elevation so i just thorw a manifest in ther to require/ask for elevation. While the registry ops should be readonly anyways its likley vista wont like this app under UAC
Brian Holloway