jeremy28
2010-Jun-26 07:56 UTC
[Wine] Problem in "porting" a function on windows to linux?
Hi all!
I use ubuntu 9.04;
I have a function called "isLogEnabled" in my project on windows, I
wanna port it to linux.
I know that I should have a "config.h" file in linux to get log from a
specific Shared object and ..., but because I'm new to linux,
I don't know how this should be done, this is my function:
Code:
//This function return True if log policy is set in registry and False otherwise
int isLogEnabled()
{
HKEY hKey;
LONG lRes;
DWORD dwType, dwSize = 0;
int retVal = 0;
if((RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\MyCorp", 0,
KEY_ALL_ACCESS, &hKey)) == ERROR_SUCCESS)
{
lRes = RegQueryValueEx(hKey, "SpecialMode", 0, &dwType,
NULL, &dwSize );
if(lRes == ERROR_SUCCESS)
retVal = 1;
RegCloseKey(hKey);
}
return retVal;
}
Since I think we don't have registry concept in linux and this function uses
registry APIs, I'm confused to change it to be compatible
with linux;
Could you help me with this please?!
TIA.
Martin Gregorie
2010-Jun-26 10:18 UTC
[Wine] Problem in "porting" a function on windows to linux?
On Sat, 2010-06-26 at 02:56 -0500, jeremy28 wrote:> Hi all! > > I use ubuntu 9.04; > I have a function called "isLogEnabled" in my project on windows, I wanna port it to linux. >Are you intending to use Linux system logs? If so, you need to modify your logging interface to use the openlog(), syslog() and closelog() functions, which are defined in syslog.h - see "man 3 syslog" for details and, since the logging system is always available, your isLogEnabled() function would become: Code: //This function return True if log policy is set in registry and False otherwise int isLogEnabled() { return 1; } Martin