2022의 게시물 표시

[Git] 자주 발생하는 이슈들

하위 디렉토리에 있는 모든 파일 추가 $ git add -f (폴더 이름)/\* $ git add -f ./\* fatal: You have not concluded your merge (MERGE_HEAD exists). Please, commit your changes before you merge. 메시지가 뜨는 경우 Git Bash에 아래 명령어 입력 $ git merge --abort Remote Branch 이름 변경 Local에 있는 Branch 이름 변경 $ git branch -m old_branch new_branch Remote에 존재하는 old_branch 삭제 $ git push origin :old_branch new_branch 푸시하기 $ git push origin new_branch Push 되돌리기 $ git reset --hard HEAD~n (n은 되돌릴 작업의 갯수 ex) git reset --hard HEAD~2) $ git push origin master (암호 입력 요구함) [Git] file name too long 이슈 $ git config --system core.longpaths true

[C++] COM 연동 샘플 소스

#import "fileName.tlb" no_namespace rename ("GetUserName","GetUserNameA") void Function() { // 프로젝트 폴더의 소스 파일이 있는 폴더 내 'fileName.tlb' 파일 수정 // 해당 'fileName.tlb' 파일에 맞춰서 'INTERFACE', 'COCLASS' 수정 // IDL 파일에서 interface INTERFACE : IDispatch // IDL 파일에서 coclass COCLASS INTERFACE * interface = NULL; if (interface == NULL) { HRESULT hr; hr = ::CoInitialize(NULL); if (SUCCEEDED(hr)) { hr = ::CoCreateInstance(__uuidof(COCLASS), NULL, CLSCTX_LOCAL_SERVER, __uuidof(INTERFACE), (void**)&interface); if (FAILED(hr)) { MessageBoxA(NULL, "COM 객체 생성 실패", "lpCaption", MB_OK); return; } else { interface->FuncCall(); ::CoUninitialize(); } } } return; }

[NSIS] 사설 인증서 등록

# 사용 예 # Call Registering_Certificate_In_Trusted_Root_Certification_Authorities Function Registering_Certificate_In_Trusted_Root_Certification_Authorities # 사설 인증서 등록 (IE, 크롬, 사파리, 오페라) ${AddCertificateToStore} $0 "$VAR_INSTDIR\cert\${CERT_NAME_COMPANY_ROOT_AUTHORITY}" ${If} $0 != success MessageBox MB_OK "certificate import failed: $0" ${EndIf} ${AddCertificateToStore} $0 "$VAR_INSTDIR\cert\${CERT_NAME_DIGICERT_HIGH_ASSURANCE_EV_ROOT_CA}" ${If} $0 != success MessageBox MB_OK "certificate import failed: $0" ${EndIf} ${AddCertificateToStore} $0 "$VAR_INSTDIR\cert\${CERT_NAME_DIGICERT_TRUSTED_ROOT_G4}" ${If} $0 != success MessageBox MB_OK "certificate import failed: $0" ${EndIf} # 사설 인증서 등록 (파이어폭스) System::Call 'shell32::SHGetSpecialFolderPath(i $HWNDPARENT, t .r2, i ${CSIDL_APPDATA}, i0)i.r0' IfFileExists "$2\Mozilla\Firefox\profiles.ini" EXIST_FIREFOX NON_EXIST_FIREFOX EXIST_FIREFOX: ...

[BAT] 문자열 변경

:: 문자열 변경 :: %(변수 이름):(찾을 문자)=(변경할 문자)% :: ex) :: set VarName=abc :: echo %VarName% :: "abc" 출력 :: set VarName=%VarName:a=d% :: echo %VarName% :: "dbc" 출력 :: set VarName=%VarName:b=% :: echo %VarName% :: "dc" 출력

Print Screen 키를 사용하여 화면 캡처 열기

접근성 - 키보드 Print Screen 바로 가기 PrtScn 단추를 사용하여 화면 캡처 열기

[Git] Repository clone

// Git Bash에서 아래 명령어 실행. git clone (URL) (폴더 이름)

[Git] Remote Branch 이름 변경

1. Local에 있는 Branch 이름 변경 git branch -m old_branch new_branch 2. Remote에 존재하는 old_branch 삭제 git push origin :old_branch 3. new_branch 푸시하기 git push origin new_branch

[Git] Push 되돌리기

git reset --hard HEAD~n (n은 되돌릴 작업의 갯수 ex) git reset --hard HEAD~2) git push origin master (암호 입력 요구함)

[Git] file name too long

git config --system core.longpaths true

[NSIS] 인증서 설치

# https://nsis.sourceforge.io/Import_Root_Certificate # 사용 예 # ${AddCertificateToStore} $0 "$VAR_INSTDIR\rootcert.cer" !define CERT_QUERY_OBJECT_FILE 1 !define CERT_QUERY_CONTENT_FLAG_ALL 16382 !define CERT_QUERY_FORMAT_FLAG_ALL 14 !define CERT_STORE_PROV_SYSTEM 10 !define CERT_STORE_OPEN_EXISTING_FLAG 0x4000 !define CERT_SYSTEM_STORE_LOCAL_MACHINE 0x20000 !define CERT_STORE_ADD_ALWAYS 4 !macro _AddCertificateToStore un Function ${un}_AddCertificateToStore Exch $0 Push $1 Push $R0 System::Call "crypt32::CryptQueryObject(i ${CERT_QUERY_OBJECT_FILE}, w r0, \ i ${CERT_QUERY_CONTENT_FLAG_ALL}, i ${CERT_QUERY_FORMAT_FLAG_ALL}, \ i 0, i 0, i 0, i 0, i 0, i 0, *i .r0) i .R0" ${If} $R0 0 System::Call "crypt32::CertOpenStore(i ${CERT_STORE_PROV_SYSTEM}, i 0, i 0, \ i ${CERT_STORE_OPEN_EXISTING_FLAG}|${CERT_SYSTEM_STORE_LOCAL_MACHINE}, \ w 'ROOT') i .r1" ${If} $1 0 System::Call "crypt32::CertAddCe...

[NSIS] 권한 상승

# https://nsis.sourceforge.io/UAC_plug-in !macro _UAC_Elevation un Function ${un}_UAC_Elevation Push $R0 Exch Pop $R0 uac_tryagain: !insertmacro UAC_RunElevated ${Switch} $0 ${Case} 0 ${IfThen} $1 = 1 ${|} Quit ${|} ;we are the outer process, the inner process has done its work, we are done ${IfThen} $3 0 ${|} ${Break} ${|} ;we are admin, let the show go on ${If} $1 = 3 ;RunAs completed successfully, but with a non-admin user MessageBox mb_YesNo|mb_IconExclamation|mb_TopMost|mb_SetForeground "This $R0 requires admin privileges, try again" /SD IDNO IDYES uac_tryagain IDNO 0 ${EndIf} ;fall-through and die ${Case} 1223 MessageBox mb_IconStop|mb_TopMost|mb_SetForeground "This $R0 requires admin privileges, aborting!" Quit ${Case} 1062 MessageBox mb_IconStop|mb_TopMost|mb_SetForeground "Logon service not running, aborting!" Quit ${Default} MessageBox mb_IconStop|mb_TopMost|mb_SetForeground "Unable to...

[NSIS] 특수 경로 얻어오기

# 설치 경로에 '$'가 포함된 특수 경로이면 해당 경로를 찾아서 SetOutPath 설정, '$'가 포함되어 있지 않으면 들어온 경로 그대로 설정. # 호출 예 # ${GetSpecialPathReplaced} '반환' '특수 경로가 포함된 경로' # ${GetSpecialPathReplaced} $0 "$DESKTOP\test" # $0 == '$DESKTOP 부분이 로컬 PC의 환경에 맞춰 경로를 얻어오고 나머지 뒷 부분은 그대로.' !define CSIDL_DESKTOP '0x0' # Desktop path ($DESKTOP) !define CSIDL_PROGRAMS '0x2' # Programs path !define CSIDL_PERSONAL '0x5' # My document path !define CSIDL_FAVORITES '0x6' # Favorites path ($FAVORITES) !define CSIDL_STARTUP '0x7' # Startup path !define CSIDL_RECENT '0x8' # Recent documents path ($RECENT) !define CSIDL_SENDTO '0x9' # Sendto documents path ($SENDTO) !define CSIDL_STARTMENU '0xB' # StartMenu path !define CSIDL_MUSIC '0xD' # My Music path ($MUSIC) !define CSIDL_DESKTOPDIR '0x10' # Desktop Directory path !define CSIDL_COMPUTER '0x11' # My Compute...

[C] Command Prompt(명령 프롬프트) 창 띄우지 않고 명령어 실행

#include <iostream> #include <Windows.h> namespace EXEC_COMMAND { namespace RETURN { namespace FAILURE { const int CREATE_PIPE = 1; const int CREATE_PROCESS = 2; } } } int ExecCommand(std::string command, std::string& output); int main() { std::string output; ExecCommand("ping -n 1 142.251.42.164", output); std::cout