LAMP安装时出现的一些错误及解决
2009-09-09 15:24
543 查看
var
tmp:string;
const
REG_INSTALL_PATH_ITEM='InstallPath';
REG_INSTALL_KEY='SOFTWARE\Blizzard Entertainment\World of Warcraft';
function readreg(sKey:string;var pBuffer:string;dwBufSize:dword;key:hkey;sSubKey:string;ulType:dword):boolean;
var
sTemp:pchar;
hSubKey: hkey;
Datatype:dword;
begin
result:=false;
if RegOpenKeyEx(key,pchar(sSubkey),0,KEY_ALL_ACCESS,hSubKey)<>0 then
begin
exit;
end;
try
getmem(sTemp,dwBufSize);
if (RegQueryValueEx(hSubKey,pchar(sKey),nil,@Datatype,pbyte(sTemp),@dwBufSize)=0)and(DataType = ulType) then
begin
pBuffer:=sTemp;
result:=true;
end;
finally
RegCloseKey(hSubKey);
freemem(sTemp);
end;
end;
begin
ReadReg( REG_INSTALL_PATH_ITEM,
Tmp,
MAX_PATH,
HKEY_LOCAL_MACHINE,
REG_INSTALL_KEY, REG_SZ
);
showmessage(tmp);
end.
===========================================
function savereg(sKey:string;pBuffer:string;dwBufSize:dword;key:hkey;sSubKey:string;ulType:dword):boolean;
var
hSubKey: hkey;
begin
result:=false;
if RegOpenKeyEx(key,pchar(sSubKey),0,KEY_ALL_ACCESS,hSubKey)<>0 then
begin
if RegCreateKey(key,pchar(sSubKey),hSubKey)<>0 then
exit;
end;
try
if RegSetValueEx(hSubKey,pchar(sKey),0,ulType,pbyte(pchar(pBuffer)),dwBufSize)=0 then
begin
result:=true;
end;
finally
RegCloseKey(hSubKey);
end;
end;
function deletereg(key:hkey;sSubKey:string;sItem:string):boolean;
var
hSubKey:hkey;
begin
result:=false;
if (key=0)or(sSubKey='') then
exit;
if sItem='' then
begin
if RegDeleteKey(key,pchar(sSubKey))=0 then
begin
result:=true;
exit;
end
else
exit;
end;
if RegOpenKeyEx(key,pchar(sSubkey),0,KEY_ALL_ACCESS,hSubKey)<>0 then
begin
exit;
end;
try
if RegDeleteValue(hSubKey, pchar(sItem))=0 then
result:=true;
finally
RegCloseKey(hSubKey);
end;
end;
tmp:string;
const
REG_INSTALL_PATH_ITEM='InstallPath';
REG_INSTALL_KEY='SOFTWARE\Blizzard Entertainment\World of Warcraft';
function readreg(sKey:string;var pBuffer:string;dwBufSize:dword;key:hkey;sSubKey:string;ulType:dword):boolean;
var
sTemp:pchar;
hSubKey: hkey;
Datatype:dword;
begin
result:=false;
if RegOpenKeyEx(key,pchar(sSubkey),0,KEY_ALL_ACCESS,hSubKey)<>0 then
begin
exit;
end;
try
getmem(sTemp,dwBufSize);
if (RegQueryValueEx(hSubKey,pchar(sKey),nil,@Datatype,pbyte(sTemp),@dwBufSize)=0)and(DataType = ulType) then
begin
pBuffer:=sTemp;
result:=true;
end;
finally
RegCloseKey(hSubKey);
freemem(sTemp);
end;
end;
begin
ReadReg( REG_INSTALL_PATH_ITEM,
Tmp,
MAX_PATH,
HKEY_LOCAL_MACHINE,
REG_INSTALL_KEY, REG_SZ
);
showmessage(tmp);
end.
===========================================
function savereg(sKey:string;pBuffer:string;dwBufSize:dword;key:hkey;sSubKey:string;ulType:dword):boolean;
var
hSubKey: hkey;
begin
result:=false;
if RegOpenKeyEx(key,pchar(sSubKey),0,KEY_ALL_ACCESS,hSubKey)<>0 then
begin
if RegCreateKey(key,pchar(sSubKey),hSubKey)<>0 then
exit;
end;
try
if RegSetValueEx(hSubKey,pchar(sKey),0,ulType,pbyte(pchar(pBuffer)),dwBufSize)=0 then
begin
result:=true;
end;
finally
RegCloseKey(hSubKey);
end;
end;
function deletereg(key:hkey;sSubKey:string;sItem:string):boolean;
var
hSubKey:hkey;
begin
result:=false;
if (key=0)or(sSubKey='') then
exit;
if sItem='' then
begin
if RegDeleteKey(key,pchar(sSubKey))=0 then
begin
result:=true;
exit;
end
else
exit;
end;
if RegOpenKeyEx(key,pchar(sSubkey),0,KEY_ALL_ACCESS,hSubKey)<>0 then
begin
exit;
end;
try
if RegDeleteValue(hSubKey, pchar(sItem))=0 then
result:=true;
finally
RegCloseKey(hSubKey);
end;
end;
相关文章推荐
- redhat编译安装postfix-3.1.1出现的一些错误及解决方法
- 乌班图安装nginx中出现的一些错误问题解决方案
- [Python3.5]解决安装一些模块时出现“error: Unable to find vcvarsall.bat”的错误
- win10_x64更新错误解决: 安装一些更新时出现问题,但我们稍后会重试。如果持续出现这些问题,并且你想要搜索Web或联系支持人员以获取相关信息,以下信息可能会对你有帮助:
- Linux下安装Oracle出现的一些错误,以及解决方法
- 解决安装软件出现错误Error 1935安装程序集
- yum安装软件包时出现Transaction Check Error:错误的解决方法
- 安装SQL2005时出现性能计数器要求安装错误的解决办法
- 安装IIS时出现安装程序无法复制文件提示:0x4b8错误的解决办法
- 安装SQL Server出现在创建窗口句柄之前,不能在控件上调用 Invoke 或 BeginInvoke的错误解决办法
- 解决win10安装.NET framework3.5出现87错误的解决办法
- 在 Mac 中安装 MySQLdb (Python mysql )出现“mysql_config not found”错误的解决方法
- 解决在centos x64 上安装openfire出现的错误
- vs2005安装wince5.0模拟器后出现无法连接设备错误的解决
- 安装msi程序出现2502、2503错误解决方法
- SQL SERVER 2008安装时出现不能在控件上调用 Invoke 或 BeginInvoke错误 解决方法
- (转)安装mysql,在./configure时出现错误:error: No curses/termcap library found的解决办法
- 用apxs 安装apache mod_proxy时候出现undefined symbol: ap_proxy_lb_workers错误的解决方法
- 教你一招:解决win10/win8.1系统在安装、卸载软件时出现2502、2503错误代码的问题
- Yum离线安装(五) --- yum 出现Public Key错误的解决