SourceCodeSky QQ客服 SourceCodeSky 400电话 客服电话 暂无
首页 » 源代码 » 虚拟桌面 » /registry.cpp

registry.cpp ( 文件浏览 )

文件源自: 虚拟桌面
  • keepall 发布于 2016-08-28 09:36
  • 浏览次数:399
  • 下载次数: 2
  • 下载需 10 积分
  • 侵权举报
/* 
   File: registry.cpp - Implementation of system registry access methods.

   Implements ZDDesk's interface to the system registry.

   Author: Steven E. Sipe
   
*/

#include "stdafx.h"

#include "zddesk.h"
#include "registry.h"


// Create the specified key 
LONG CZDRegistry::Create(HKEY hRootKey, LPCTSTR lpszSubKey, REGSAM regSam, HKEY& hKey) 
{
   DWORD dwResult;

   LONG lRet = ::RegCreateKeyEx(
                      hRootKey,         // Root key
                      lpszSubKey,      // Subkey name
                      0L,               // Reserved
                      "",               // Class name
                      REG_OPTION_NON_VOLATILE,   // Permanent key
                      regSam,            // Security access
                      NULL,            // Security descriptor
                      &hKey,            // Key returned
                      &dwResult);      // Indicates if new key was created

   return(lRet);
}

// Open the specified key -- create it if it doesn't exist (call Create() method)
LONG CZDRegistry::Open(HKEY hRootKey, LPCTSTR lpszSubKey, REGSAM regSam, HKEY& hKey) 
{
   LONG lRet = ::RegOpenKeyEx(
                     hRootKey,         // Root to open
                     lpszSubKey,         // Key to open
                     0L,               // Reserved
                     regSam,            // Security access
                     &hKey);            // Key returned

   // This means that the key doesn't exist...so add it
   if(lRet == ERROR_FILE_NOT_FOUND)
      lRet = Create(hRootKey,lpszSubKey,regSam,hKey);

   return(lRet);
}

// Close the specifed key
LONG CZDRegistry::Close(HKEY hKey)
{
   LONG lRet = ::RegCloseKey(hKey);

   return(lRet);
}

// Get the specified key's value
LONG CZDRegistry::GetValue(HKEY hKey, LPCTSTR lpszValueName, DWORD dwDataType, 
                                    LPVOID lpvData, DWORD dwBuffSize)
{
   // These parameters must be passed by reference so copy the ones we 
   // passed by value to a temporary placeholder
   DWORD dwTempDataType = dwDataType;
   DWORD dwTempBuffSize = dwBuffSize;

   // Get the specified value
   LONG lRet = ::RegQueryValueEx(
                     hKey,               // Local machine config
                     lpszValueName,      // Value name
                     0L,               // Reserved
                     &dwTempDataType,   // Key type 
                     (LPBYTE) lpvData,   // Data buffer
                     &dwTempBuffSize);   // Length of data buffer
   
   return(lRet);
}

// Sets the value of the specified registry key
LONG CZDRegistry::SetValue(HKEY hKey, LPCTSTR lpszValueName, DWORD dwType,
                                 const LPVOID lpvData, DWORD dwDataSize)
{                           
   LONG lRet = ::RegSetValueEx(
                     hKey,               // Key handle
                     lpszValueName,      // Value name
   [!==More==!]			
...
展开> <收缩

下载源码到电脑,阅读使用更方便

1 积分

快速下载
还剩0行未阅读,继续阅读
免费下载源码
Sponsored links

源码文件列表

温馨提示: 点击源码文件名可预览文件内容哦 ^_^
...
名称 大小 修改日期
/registry.cpp 3.17 KB 1997-06-30 21:14:32
/property.cpp 4.19 KB 1997-06-30 21:14:32
/arrange.cpp 11.46 KB 1997-06-30 21:14:32
/zddesk.dsp 6.86 KB 1997-05-29 09:39:32
/zddesk.aps 71.35 KB 1997-06-30 21:24:34
/zddesk.rc 10.53 KB 1997-06-30 21:24:34
/resource.h 3.14 KB 1997-06-30 21:14:36
/frame.h 4.61 KB 1997-06-30 21:14:36
/arrange.h 2.16 KB 1997-06-30 21:14:36
/tray.h 1.20 KB 1997-06-30 21:14:36
/registry.h 913 Bytes 1997-06-30 21:14:36
/property.h 1.32 KB 1997-06-30 21:14:36
/zddesk.mak 9.55 KB 1997-06-11 23:49:46
/zddesk.mdp 36.00 KB 1997-06-25 22:26:02
/zddesk.clw 3.26 KB 1997-06-30 21:21:12
/zddesk.dsw 535 Bytes 1997-05-12 20:15:20
/zddesk.plg 1.65 KB 1997-06-02 09:38:16
/splash.h 1.17 KB 1997-06-30 21:14:36
/debug/ 0 Bytes 1997-05-26 17:03:26
/release/ 0 Bytes 1997-05-26 17:03:26
/res/ 0 Bytes 1997-05-26 17:03:26
/stdafx.h 471 Bytes 1997-06-30 21:14:36
/splash.cpp 3.30 KB 1997-06-30 21:14:32
/stdafx.cpp 208 Bytes 1997-06-30 21:14:32
/tray.cpp 2.60 KB 1997-06-30 21:14:32
/frame.cpp 20.43 KB 1997-06-30 21:14:32
/zddesk.h 2.08 KB 1997-06-30 21:14:36
/zddesk.cpp 5.66 KB 1997-06-30 21:14:32
/res/zddesk5.ico 1.05 KB 1997-05-02 22:48:26
/res/zddesk4.ico 1.05 KB 1997-05-02 22:56:50
/res/zddesk3.ico 1.05 KB 1997-05-02 22:43:30
/res/zddesk2.ico 1.05 KB 1997-05-02 22:56:50
/res/zddesk1.ico 1.05 KB 1997-05-02 22:56:50
/res/zddesk9.ico 1.05 KB 1997-05-02 22:55:12
/res/zddesk8.ico 1.05 KB 1997-05-02 22:53:34
/res/zddesk7.ico 1.05 KB 1997-05-02 22:51:36
/res/zddesk6.ico 1.05 KB 1997-05-02 22:49:50
/res/zddesk.ico 1.05 KB 1997-06-11 23:36:14
/res/list.bmp 358 Bytes 1997-05-01 00:39:54
/res/splsh16.bmp 18.09 KB 1997-06-30 21:24:34
/res/zddesk.rc2 397 Bytes 1997-01-30 11:35:14
/res/nodrop.cur 326 Bytes 1997-05-02 22:00:26
/res/drop.cur 326 Bytes 1997-05-02 22:00:26
Sponsored links
正在加载中……

Switch to the English version?

Yes
SourceCodeSky 英文版
No
SourceCodeSky 中文版

完善个人资料,获价值¥30元积分奖励!