Subversion Repositories Aucun

Rev

Rev 40 | Rev 100 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
5 ixe013 1
#include <windows.h>
2
#include "settings.h"
3
 
40 ixe013 4
const wchar_t* gUnlockGroupName = L"unlock";
5
const wchar_t* gForceLogoffGroupName = L"force logoff";
6
const wchar_t* gExcludedGroupName = L"excluded";
7
 
8
 
9
HRESULT GetSettingText(const wchar_t *key, const wchar_t *name, wchar_t *text, DWORD size);
10
 
91 ixe013 11
//Will return one of the following
12
//S_OK We have retrieved a group name
13
//E_FAIL We have not retrieved a value
40 ixe013 14
HRESULT GetGroupName(const wchar_t *name, wchar_t *group, DWORD size)
5 ixe013 15
{
40 ixe013 16
    return GetSettingText(L"SOFTWARE\\Paralint.com\\Aucun\\Groups", name, group, size);
17
}
18
 
19
HRESULT GetNoticeText(const wchar_t *name, wchar_t *text, DWORD size)
20
{
21
    return GetSettingText(L"SOFTWARE\\Paralint.com\\Aucun\\Notice", name, text, size);
22
}
23
 
91 ixe013 24
HRESULT GetDebugSetting(const wchar_t *name, wchar_t *text, DWORD size)
25
{
26
    return GetSettingText(L"SOFTWARE\\Paralint.com\\Aucun\\Debug", name, text, size);
27
}
28
 
29
 
40 ixe013 30
HRESULT GetSettingText(const wchar_t *key, const wchar_t *name, wchar_t *text, DWORD size)
31
{
16 ixe013 32
   HRESULT result = E_FAIL;
33
   DWORD type;
34
   DWORD returnedsize = size;
5 ixe013 35
 
16 ixe013 36
   HKEY reg;
5 ixe013 37
 
40 ixe013 38
   if(RegOpenKeyEx(HKEY_LOCAL_MACHINE, key, 0, KEY_READ, &reg) == ERROR_SUCCESS)
39
   {
40
       if (RegQueryValueEx(reg, name, 0, &type, (LPBYTE)text, &returnedsize) == ERROR_SUCCESS)
41
       {
42
          if ((type == REG_SZ) && (returnedsize < size) && (returnedsize > 0))
43
          {
44
             result = S_OK;
45
          }
46
       }
47
 
48
        RegCloseKey(reg);
16 ixe013 49
   }
5 ixe013 50
 
16 ixe013 51
   return result;
5 ixe013 52
}
53