Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Private Attributes
ProfileWin Class Reference

#include <profilew.h>

Inheritance diagram for ProfileWin:
Inheritance graph
[legend]
Collaboration diagram for ProfileWin:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 ProfileWin ()
 ~ProfileWin ()
BOOL getBool (char *key, BOOL *value)
BOOL setBool (char *key, BOOL value)
BOOL getString (char *key, char *string, int size)
BOOL setString (char *key, char *string)
BOOL getSizeAndPosition (int *width, int *height, int *x, int *y)
BOOL setSizeAndPosition (int width, int height, int x, int y)

Private Attributes

HKEY hKey

Detailed Description

Definition at line 43 of file profilew.h.


Constructor & Destructor Documentation

Definition at line 42 of file profilew.cpp.

                       : Profile()
{
  hKey = NULL;
  char szClass[] = "SpyPluginClass";
  DWORD disp = 0L;

  LONG res = RegCreateKeyEx(HKEY_LOCAL_MACHINE, 
                            NPSPY_REG_SUBKEY, 
                            0L, 
                            szClass, 
                            0L, 
                            KEY_READ | KEY_WRITE, 
                            NULL, 
                            &hKey, 
                            &disp);

  if(res != ERROR_SUCCESS)
    hKey = NULL;
}

Definition at line 62 of file profilew.cpp.

{
  if(hKey)
    RegCloseKey(hKey);
}

Member Function Documentation

BOOL ProfileWin::getBool ( char *  key,
BOOL value 
) [virtual]

Implements Profile.

Definition at line 68 of file profilew.cpp.

{
  if(!value)
    return FALSE;

  DWORD size = sizeof(DWORD);
  DWORD val = 1L;
  LONG res = RegQueryValueEx(hKey, key, 0L, NULL, (BYTE *)&val, &size);

  if(res != ERROR_SUCCESS)
    return FALSE;

  *value = (val == 0L) ? FALSE : TRUE;

  return TRUE;
}

Here is the caller graph for this function:

BOOL ProfileWin::getSizeAndPosition ( int width,
int height,
int x,
int y 
)

Definition at line 106 of file profilew.cpp.

{
  DWORD size = sizeof(DWORD);
  LONG res = ERROR_SUCCESS;

  res = RegQueryValueEx(hKey, NPSPY_REG_KEY_WIDTH, 0L, NULL, (BYTE *)width, &size);
  if(res != ERROR_SUCCESS)
    return FALSE; 

  res = RegQueryValueEx(hKey, NPSPY_REG_KEY_HEIGHT, 0L, NULL, (BYTE *)height, &size);
  if(res != ERROR_SUCCESS)
    return FALSE; 

  res = RegQueryValueEx(hKey, NPSPY_REG_KEY_X, 0L, NULL, (BYTE *)x, &size);
  if(res != ERROR_SUCCESS)
    return FALSE; 

  res = RegQueryValueEx(hKey, NPSPY_REG_KEY_Y, 0L, NULL, (BYTE *)y, &size);
  if(res != ERROR_SUCCESS)
    return FALSE; 

  return TRUE;
}

Here is the caller graph for this function:

BOOL ProfileWin::getString ( char *  key,
char *  string,
int  size 
) [virtual]

Implements Profile.

Definition at line 93 of file profilew.cpp.

{
  LONG res = RegQueryValueEx(hKey, key, 0L, NULL, (BYTE *)string, (DWORD *)&size);
  return (res == ERROR_SUCCESS);
}

Here is the caller graph for this function:

BOOL ProfileWin::setBool ( char *  key,
BOOL  value 
) [virtual]

Implements Profile.

Definition at line 85 of file profilew.cpp.

{
  DWORD size = sizeof(DWORD);
  DWORD val = value ? 1L : 0L;
  LONG res = RegSetValueEx(hKey, key, 0L, REG_DWORD, (const BYTE *)&val, size);
  return (res == ERROR_SUCCESS);
}

Here is the caller graph for this function:

BOOL ProfileWin::setSizeAndPosition ( int  width,
int  height,
int  x,
int  y 
)

Definition at line 130 of file profilew.cpp.

{
  DWORD size = sizeof(DWORD);
  LONG res = ERROR_SUCCESS;
  
  res = RegSetValueEx(hKey, NPSPY_REG_KEY_WIDTH, 0L, REG_DWORD, (const BYTE *)&width, size);
  if(res != ERROR_SUCCESS)
    return FALSE;
  
  res = RegSetValueEx(hKey, NPSPY_REG_KEY_HEIGHT, 0L, REG_DWORD, (const BYTE *)&height, size);
  if(res != ERROR_SUCCESS)
    return FALSE;
  
  res = RegSetValueEx(hKey, NPSPY_REG_KEY_X, 0L, REG_DWORD, (const BYTE *)&x, size);
  if(res != ERROR_SUCCESS)
    return FALSE;
  
  res = RegSetValueEx(hKey, NPSPY_REG_KEY_Y, 0L, REG_DWORD, (const BYTE *)&y, size);
  if(res != ERROR_SUCCESS)
    return FALSE;

  return TRUE;
}

Here is the caller graph for this function:

BOOL ProfileWin::setString ( char *  key,
char *  string 
) [virtual]

Implements Profile.

Definition at line 99 of file profilew.cpp.

{
  DWORD size = strlen(string);
  LONG res = RegSetValueEx(hKey, key, 0L, REG_SZ, (const BYTE *)string, size);
  return (res == ERROR_SUCCESS);
}

Here is the caller graph for this function:


Member Data Documentation

Definition at line 45 of file profilew.h.


The documentation for this class was generated from the following files: