Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
RegstryHandler.cpp
Package: LegendOfMir2_Server020418.zip [view]
Upload User: szopptop
Upload Date: 2013-04-23
Package Size: 1047k
Code Size: 2k
Category:
Game Server Simulator
Development Platform:
Visual C++
- // ****************************************************************************
- //
- // Registry Handler
- //
- // All written by Jeong, Euy-heon
- // Copyright(C) 1997, 1998 Euy-heon, Jeong. All right reserved.
- //
- // ****************************************************************************
- #include "stdafx.h"
- // ****************************************************************************
- //
- // jRegGetKey/jRegSetKey
- //
- // Last update : 1997.07.16 (Euy-heon, Jeong)
- // Purpose : Get and set Windows null-terminate string regstry keys.
- //
- // ****************************************************************************
- BOOL jRegSetKey(LPCTSTR pSubKeyName, LPCTSTR pValueName, DWORD dwFlags,
- LPBYTE pValue, DWORD nValueSize)
- {
- HKEY hk = NULL;
- DWORD dwDisposition = 0;
- if (RegCreateKeyEx(HKEY_LOCAL_MACHINE, pSubKeyName, 0, NULL,
- REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL,
- &hk, &dwDisposition) == ERROR_SUCCESS)
- {
- if (RegSetValueEx(hk, pValueName, 0, dwFlags, pValue, nValueSize) != ERROR_SUCCESS)
- {
- RegCloseKey(hk);
- return FALSE;
- }
- RegCloseKey(hk);
- return TRUE;
- }
- return FALSE;
- }
- BOOL jRegGetKey(LPCTSTR pSubKeyName, LPCTSTR pValueName, LPBYTE pValue)
- {
- HKEY hk = NULL;
- DWORD dwFlags = 0, dwValueSize = 0;
- if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, pSubKeyName, 0, KEY_READ, &hk) == ERROR_SUCCESS)
- {
- if (RegQueryValueEx(hk, pValueName, NULL, &dwFlags, NULL, &dwValueSize) != ERROR_SUCCESS)
- {
- RegCloseKey(hk);
- return FALSE;
- }
- RegQueryValueEx(hk, pValueName, NULL, &dwFlags, pValue, &dwValueSize);
- RegCloseKey(hk);
- return TRUE;
- }
- return FALSE;
- }
- LONG jRegEnumKey(LPCTSTR pSubKeyName, int nIndex, LPTSTR lpSubKey, int nSubkeyLen)
- {
- HKEY hk = NULL;
- DWORD dwSubKeyLen = nSubkeyLen;
- FILETIME ft;
- LONG lRet = -1;
- if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, pSubKeyName, 0, KEY_READ, &hk) == ERROR_SUCCESS)
- {
- lRet = RegEnumKeyEx(hk, nIndex, lpSubKey, &dwSubKeyLen, NULL, NULL, NULL, &ft);
- RegCloseKey(hk);
- }
- return lRet;
- }