C++Builder Programming Forum
C++Builder  |  Delphi  |  FireMonkey  |  C/C++  |  Free Pascal  |  Firebird
볼랜드포럼 BorlandForum
 경고! 게시물 작성자의 사전 허락없는 메일주소 추출행위 절대 금지
C++빌더 포럼
Q & A
FAQ
팁&트릭
강좌/문서
자료실
컴포넌트/라이브러리
메신저 프로젝트
볼랜드포럼 홈
헤드라인 뉴스
IT 뉴스
공지사항
자유게시판
해피 브레이크
공동 프로젝트
구인/구직
회원 장터
건의사항
운영진 게시판
회원 메뉴
북마크
볼랜드포럼 광고 모집

C++빌더 Q&A
C++Builder Programming Q&A
[63806] Re:Re:프로그램 추가/제거 구현할라고합니다.질문 좀드릴께요
향수 [tmakdlf1522] 1370 읽음    2011-02-23 11:30
감사합니다.  해당 웹사이트에 좋은 정보들이 많이 있내요.

nansama 님이 쓰신 글 :
: 질문을 정확히 모르겠지만 레지스트리 처리 관련해서 NSIS 오픈소스 ( nsis.sourceforge.net )
: 를 참고 하면 다음과 같이 처리 하고 있습니다.
:
:
: 
: void NSISCALL myRegGetStr(HKEY root, const char *sub, const char *name, char *out, int x64)
: {
:   HKEY hKey;
:   *out=0;
:   if (RegOpenKeyEx(root,sub,0,KEY_READ|(x64?KEY_WOW64_64KEY:0),&hKey) == ERROR_SUCCESS)
:   {
:     DWORD l = NSIS_MAX_STRLEN;
:     DWORD t;
:     if (RegQueryValueEx(hKey,name,NULL,&t,out,&l ) != ERROR_SUCCESS || (t != REG_SZ && t != REG_EXPAND_SZ)) *out=0;
:     out[NSIS_MAX_STRLEN-1]=0;
:     RegCloseKey(hKey);
:   }
: }
: 
: // based loosely on code from Tim Kosse
: // in win9x this isn't necessary (RegDeleteKey() can delete a tree of keys),
: // but in win2k you need to do this manually.
: static LONG NSISCALL myRegDeleteKeyEx(HKEY thiskey, LPCTSTR lpSubKey, int onlyifempty)
: {
:   HKEY key;
:   int retval=RegOpenKeyEx(thiskey,lpSubKey,0,AlterRegistrySAM(KEY_ENUMERATE_SUB_KEYS),&key);
:   if (retval==ERROR_SUCCESS)
:   {
:     // NB - don't change this to static (recursive function)
:     char buffer[MAX_PATH+1];
:     while (RegEnumKey(key,0,buffer,MAX_PATH+1)==ERROR_SUCCESS)
:     {
:       if (onlyifempty)
:       {
:         RegCloseKey(key);
:         return !ERROR_SUCCESS;
:       }
:       if ((retval=myRegDeleteKeyEx(key,buffer,0)) != ERROR_SUCCESS) break;
:     }
:     RegCloseKey(key);
:     {
:       typedef LONG (WINAPI * RegDeleteKeyExAPtr)(HKEY, LPCTSTR, REGSAM, DWORD);
:       RegDeleteKeyExAPtr RDKE = (RegDeleteKeyExAPtr)
:         myGetProcAddress(MGA_RegDeleteKeyExA);
: 
:       if (RDKE)
:         retval=RDKE(thiskey,lpSubKey,AlterRegistrySAM(0),0);
:       else
:         retval=g_exec_flags.alter_reg_view||RegDeleteKey(thiskey,lpSubKey);
:     }
:   }
:   return retval;
: }  
: 

:
:
: 향수 님이 쓰신 글 :
: : 프로그램 추가/제거 어느정도는 구현을 하였습니다..
: :
: : 문제가 리스트중에 업데이트 관련은 예외 처리 해야하며 64/32비트 차이랑 있내요..
: :
: : 2가지 문제 점이있어서 그렇습니다..
: :
: : 마이크로소프트에서 따로 지원 하는 api 있나해서 문의 드립니다..
: :
: :  아니면 업데이트 관련 부분은 예외 처리하는 부분 힌트라도 좀 부탁드립니다~
: :
: : 간단한 형식은.
: : 아래 처럼 구현 하였습니다.. 코딩 부분이 전체 적으로 복사를안했기에 코딩이 안맞습니다. 참고해주세요..
: :
: :
: :     TRegistry *reg = new TRegistry;
: :         TStringList *UnKey = new TStringList;
: :         reg->RootKey = HKEY_LOCAL_MACHINE;
: :     if( reg->OpenKey("Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall",False))
: :     {
: :         reg->GetKeyNames(UnKey);
: :         reg->CloseKey();
: :     }
: :            int a = 0 ;
: :             for ( int j=0 ; j < UnKey->Count ; j++)
: :             {
: :                 if( reg->OpenKey("Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\" + UnKey->Strings[j],False))
: :                 {

+ -

관련 글 리스트
63802 프로그램 추가/제거 구현할라고합니다.질문 좀드릴께요 향수 1148 2011/02/22
63804     Re:프로그램 추가/제거 구현할라고합니다.질문 좀드릴께요 nansama 1313 2011/02/23
63806         Re:Re:프로그램 추가/제거 구현할라고합니다.질문 좀드릴께요 향수 1370 2011/02/23
Google
Copyright © 1999-2015, borlandforum.com. All right reserved.