RegDBGetKeyValueEx returns -1

 ̄綄美尐妖づ 提交于 2019-12-18 09:46:18

问题


I am using below installscript code to identify whether SharePoint is installed or not. but its not working. The function returns -1. Not sure what is the issue. can someone please help? I want to do below steps

  1. Reach to this registry location first ""SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\15.0""

  2. Read Name "SharePoint" and its value "Installed"

refer attached image.

function IsSharePointInstalled()
STRING szKey, svValue, szName;
NUMBER nvType, nvSize;

begin           
    RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);        
    szKey = "SOFTWARE\\Microsoft\\Shared Tools\\Web Server 
             Extensions\\15.0";         
    szName = "SharePoint";          

    if(RegDBKeyExist (szKey) >=1) then          
        MessageBox("Key found", INFORMATION);       

    if(RegDBGetKeyValueEx(szKey, szName, nvType, svValue, nvSize) < 0) then
        MessageBox("Failed to get value", INFORMATION);
    else                        
        MessageBox("Successfully got value", INFORMATION);
    endif;
   endif;

RegDBSetDefaultRoot(HKEY_CLASSES_ROOT);                 
end;                    

Image


回答1:


Installscipt: Where is your value located? Have you accounted for the 64- versus 32 bit sections of the registry?

  • HKEY_LOCAL_MACHINE\SOFTWARE

  • HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node

Perhaps investigate the 64-bit option here (REGDB_OPTION_WOW64_64KEY) if you need the 64-bit section of the registry.


AppSearch: for a simple registry retrieval like this, you could use AppSearch instead (System Search View). I don't have the time to make a sample for that right now. You can also see the System Search View / Wizard.



来源:https://stackoverflow.com/questions/50694678/regdbgetkeyvalueex-returns-1

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!