출처 : http://cafe.naver.com/monhun/209148
분류 전체보기
- [MHFU] 투구 한글명 vs 영어 - 펌 2014.08.05
- [MHFU] 무기 한글명 vs 영문명 - 펌 2014.08.05
- [MHFU] 아이템 한글명 vs 영문명 - 펌 2014.08.05
- [MHFU] 영문 아이템/방어구/조합 리스트 링크 2014.08.05
- 뭉쳐진 HTML 깔끔하게 보기 2014.07.09
- [C++][COM] Notify creating process by WMI 2014.04.09
- SSL 정보 확인 방법. 2014.03.26
- [VC++] operator << 2014.03.08
- [VC++] Visual Studio 디버깅 팁 2014.03.06
- web tracerout 2014.01.14
- [VC++] getaddrinfo 로 도메인주소가 지정한 모든 아이피에 접속해본다... 2013.10.26
- [GIT] PuttyKey 로 접속할때 Load PuttyKey 가 활성화 되지 않을때.. 2013.10.19
- [C++] std::cout 에 hex 로? oct 로? 2013.09.10
- 이벤트 로그 한방에 삭제하기 2013.09.07
- [tool] 하드 파일/폴더별 용량을 면적으로 표시하자..SpaceSniffer 2013.08.30
- [VC] socket id(Descriptor) 에서 연결정보 알아내기 2013.07.18
- vhd 용량 줄이기 2013.06.29
- 클래스 멤버 함수포인트 얻는 방법? 2013.06.28
- 콘솔에 색깔을 입혀보자.. 2013.06.13
- 구글 url 검색 2013.06.08
- [VC] 파일 드래그앤드롭 (Drag Drop) 2013.06.06
- 이번주말에!!!!! 2013.06.06
- 좋~~다~! 2013.06.04
- USB/CD 자동실행 방지 2013.06.01
- 해외에서 운전경력증 발급하기 2013.05.15
- 아.. 짜증나기 시작했다... 2013.04.27
- [VC] 하나의 솔루션에 여러개의 프로젝트 디버깅(서버 클라 구조) 2013.04.23
- [VC] The project is out of date: <= 짲응. 2013.04.11
- [C++] CreateProcess Access violation error 2013.02.23
- [VC++] 컴퓨터 이름 알아내기. 2013.01.03
[MHFU] 투구 한글명 vs 영어 - 펌
[MHFU] 무기 한글명 vs 영문명 - 펌
출처 : http://cafe.naver.com/monhun/209144
[MHFU] 아이템 한글명 vs 영문명 - 펌
출처 : http://cafe.naver.com/monhun/208969
[MHFU] 영문 아이템/방어구/조합 리스트 링크
몇년만에 다시 시작하는 몬스터헌터다.
아이템 리스트
http://monsterhunter.wikia.com/wiki/MHFU:_Item_List
방어구 리스트
http://monsterhunter.wikia.com/wiki/Armor_List
아이템 조합 정보
http://monsterhunter.wikia.com/wiki/MHF2_and_MHFU:_Combination_List
드랍아이템들
http://monsterhunter.wikia.com/wiki/MHFU:_Dropped_Items_Guide
뭉쳐진 HTML 깔끔하게 보기
http://tools.arantius.com/tabifier
[C++][COM] Notify creating process by WMI
#define _WIN32_DCOM #include <iostream> using namespace std; #include <comdef.h> #include <Wbemidl.h> #include <atlcomcli.h> #pragma comment(lib, "wbemuuid.lib") class EventSink : public IWbemObjectSink { LONG m_lRef; bool bDone; public: EventSink() { m_lRef = 0; } ~EventSink() { bDone = true; } virtual ULONG STDMETHODCALLTYPE AddRef() { return InterlockedIncrement(&m_lRef); } virtual ULONG STDMETHODCALLTYPE Release() { LONG lRef = InterlockedDecrement(&m_lRef); if(lRef == 0) delete this; return lRef; } virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppv) { if (riid == IID_IUnknown || riid == IID_IWbemObjectSink) { *ppv = (IWbemObjectSink *) this; AddRef(); return WBEM_S_NO_ERROR; } else return E_NOINTERFACE; } virtual HRESULT STDMETHODCALLTYPE Indicate( LONG lObjectCount, IWbemClassObject __RPC_FAR *__RPC_FAR *apObjArray ) { HRESULT hres = S_OK; for (int i = 0; i < lObjectCount; i++) { IWbemClassObject *pObj = apObjArray[i]; _variant_t vtProp; // Get the value of the Name property // ->GetNames(); //HRESULT hr = pObj->Get(L"Name", 0, &vtProp, 0, 0); HRESULT hr = pObj->Get(_bstr_t(L"TargetInstance"), 0, &vtProp, 0, 0); if (!FAILED(hr)) { IUnknown* str = vtProp; hr = str->QueryInterface( IID_IWbemClassObject, reinterpret_cast< void** >( &apObjArray[i] ) ); if ( SUCCEEDED( hr ) ) { _variant_t cn; hr = apObjArray[i]->Get( L"Name", 0, &cn, NULL, NULL ); if ( SUCCEEDED( hr ) ) { if ((cn.vt==VT_NULL) || (cn.vt==VT_EMPTY)) std::wcout << "Name : " << ((cn.vt==VT_NULL) ? "NULL" : "EMPTY") << endl; else std::wcout << "Name : " << cn.bstrVal << endl; } VariantClear(&cn); hr = apObjArray[i]->Get( L"ProcessId", 0, &cn, NULL, NULL ); if ( SUCCEEDED( hr ) ) { if ((cn.vt==VT_NULL) || (cn.vt==VT_EMPTY)) std::wcout << "PID : " << ((cn.vt==VT_NULL) ? "NULL" : "EMPTY") << endl; else if ( cn.vt == VT_I4 ) std::wcout << "PID : " << cn.intVal << endl; else std::wcout << "PID : " << cn.bstrVal << endl; } VariantClear(&cn); } } VariantClear(&vtProp); } return WBEM_S_NO_ERROR; } virtual HRESULT STDMETHODCALLTYPE SetStatus( /* [in] */ LONG lFlags, /* [in] */ HRESULT hResult, /* [in] */ BSTR strParam, /* [in] */ IWbemClassObject __RPC_FAR *pObjParam ) { if(lFlags == WBEM_STATUS_COMPLETE) { printf("Call complete. hResult = 0x%X\n", hResult); } else if(lFlags == WBEM_STATUS_PROGRESS) { printf("Call in progress.\n"); } return WBEM_S_NO_ERROR; } }; int _tmain(int argc, _TCHAR* argv[]) { HRESULT hres; // Step 1: -------------------------------------------------- // Initialize COM. ------------------------------------------ hres = CoInitializeEx(0, COINIT_MULTITHREADED); if (FAILED(hres)) { cout << "Failed to initialize COM library. Error code = 0x" << hex << hres << endl; return 1; // Program has failed. } // Step 2: -------------------------------------------------- // Set general COM security levels -------------------------- hres = CoInitializeSecurity( NULL, -1, // COM negotiates service NULL, // Authentication services NULL, // Reserved RPC_C_AUTHN_LEVEL_DEFAULT, // Default authentication RPC_C_IMP_LEVEL_IMPERSONATE, // Default Impersonation NULL, // Authentication info EOAC_NONE, // Additional capabilities NULL // Reserved ); if (FAILED(hres)) { cout << "Failed to initialize security. Error code = 0x" << hex << hres << endl; CoUninitialize(); return 1; // Program has failed. } // Step 3: --------------------------------------------------- // Obtain the initial locator to WMI ------------------------- IWbemLocator *pLoc = NULL; hres = CoCreateInstance( CLSID_WbemLocator, 0, CLSCTX_INPROC_SERVER, IID_IWbemLocator, (LPVOID *) &pLoc); if (FAILED(hres)) { cout << "Failed to create IWbemLocator object. " << "Err code = 0x" << hex << hres << endl; CoUninitialize(); return 1; // Program has failed. } // Step 4: --------------------------------------------------- // Connect to WMI through the IWbemLocator::ConnectServer method IWbemServices *pSvc = NULL; // Connect to the local root\cimv2 namespace // and obtain pointer pSvc to make IWbemServices calls. hres = pLoc->ConnectServer( _bstr_t(L"ROOT\\CIMV2"), NULL, NULL, 0, NULL, 0, 0, &pSvc ); if (FAILED(hres)) { cout << "Could not connect. Error code = 0x" << hex << hres << endl; pLoc->Release(); CoUninitialize(); return 1; // Program has failed. } cout << "Connected to ROOT\\CIMV2 WMI namespace" << endl; // Step 5: -------------------------------------------------- // Set security levels on the proxy ------------------------- hres = CoSetProxyBlanket( pSvc, // Indicates the proxy to set RPC_C_AUTHN_WINNT, // RPC_C_AUTHN_xxx RPC_C_AUTHZ_NONE, // RPC_C_AUTHZ_xxx NULL, // Server principal name RPC_C_AUTHN_LEVEL_CALL, // RPC_C_AUTHN_LEVEL_xxx RPC_C_IMP_LEVEL_IMPERSONATE, // RPC_C_IMP_LEVEL_xxx NULL, // client identity EOAC_NONE // proxy capabilities ); if (FAILED(hres)) { cout << "Could not set proxy blanket. Error code = 0x" << hex << hres << endl; pSvc->Release(); pLoc->Release(); CoUninitialize(); return 1; // Program has failed. } // Step 6: ------------------------------------------------- // Receive event notifications ----------------------------- // Use an unsecured apartment for security IUnsecuredApartment* pUnsecApp = NULL; hres = CoCreateInstance(CLSID_UnsecuredApartment, NULL, CLSCTX_LOCAL_SERVER, IID_IUnsecuredApartment, (void**)&pUnsecApp); EventSink* pSink = new EventSink; pSink->AddRef(); IUnknown* pStubUnk = NULL; pUnsecApp->CreateObjectStub(pSink, &pStubUnk); IWbemObjectSink* pStubSink = NULL; pStubUnk->QueryInterface(IID_IWbemObjectSink, (void **) &pStubSink); // The ExecNotificationQueryAsync method will call // The EventQuery::Indicate method when an event occurs hres = pSvc->ExecNotificationQueryAsync( _bstr_t("WQL"), _bstr_t("SELECT * " "FROM __InstanceCreationEvent WITHIN 1 " "WHERE TargetInstance ISA 'Win32_Process'"), WBEM_FLAG_SEND_STATUS, NULL, pStubSink); // Check for errors. if (FAILED(hres)) { printf("ExecNotificationQueryAsync failed " "with = 0x%X\n", hres); pSvc->Release(); pLoc->Release(); pUnsecApp->Release(); pStubUnk->Release(); pSink->Release(); pStubSink->Release(); CoUninitialize(); return 1; } // Wait for the event Sleep(20000); hres = pSvc->CancelAsyncCall(pStubSink); // Cleanup // ======== pSvc->Release(); pLoc->Release(); pUnsecApp->Release(); pStubUnk->Release(); pSink->Release(); pStubSink->Release(); CoUninitialize(); return 0; // Program successfully completed. }
SSL 정보 확인 방법.
Rapid7 의 보고서에서 지적질 당한 구버전 SSL 사용을 어떻게 체크해야하는지 난감했는데, 역시나 OWASP 에서 상세히 설명하고 있다.
https://www.owasp.org/index.php/Testing_for_SSL-TLS_(OWASP-CM-001)
1. nessus 로 스캔
2. openssl 으로 특정 SSL 버전을 주고 직접 붙어보기.
ex: c:\> openssl s_client -no_tls1 -no_ssl3 -connect www.google.com:443
3. SSLScan 사용하기.
3.1 http://code.google.com/p/sslscan-win/ 다운로드
3.2 c:\> SSLScan --no-failed mail.google.com
결과에서 sslV2 중에 약한 암호화 강도 알고리즘을 사용한것만 찾아낸다.
암호화 강도가 약한놈들을 모르겠다면 나처럼 sslv3 랑 tlsv1 만 세팅한다.
[VC++] operator <<
template <typename T>
makecmd & operator<<(T const & datum)
{
append( boost::lexical_cast<std::string>(datum) );
return *this;
}
[VC++] Visual Studio 디버깅 팁
http://www.codeproject.com/Articles/518159/10-Even-More-Visual-Studio-Debugging-Tips-for-Nati
web tracerout
http://tracert.com/traceroute?t=?.?.?.?
[VC++] getaddrinfo 로 도메인주소가 지정한 모든 아이피에 접속해본다...
MS 의 소스를 살펴보다가 평소에 알지 못하던 코드가 궁금하여(영어를 이해못했나?) 테스트 해봤습니다.
iResult = getaddrinfo(SeverAddress.c_str(), ServerPort, &hints, &result); if ( iResult != 0 ) { printf("getaddrinfo failed with error: %d\n", iResult); WSACleanup(); return 1; } // Attempt to connect to an address until one succeeds for(ptr=result; ptr != NULL ;ptr=ptr->ai_next) { // Create a SOCKET for connecting to server socket_ = socket(ptr->ai_family, ptr->ai_socktype, ptr->ai_protocol); if (socket_ == INVALID_SOCKET) { m_dwLastError = WSAGetLastError(); WSACleanup(); return false; } // Connect to server. iResult = ::connect(socket_, ptr->ai_addr, (int)ptr->ai_addrlen); if (iResult == SOCKET_ERROR) { closesocket(socket_); socket_ = INVALID_SOCKET; continue; } break; } |
getaddrinfo 는 어떤식으로 동작할까나? MSDN 의 소스를 실행해보니
http://msdn.microsoft.com/en-us/library/windows/desktop/ms737530(v=vs.85).aspx
Calling getaddrinfo with following parameters: nodename = www.google.com servname (or port) = HTTP getaddrinfo returned success getaddrinfo response 1 Flags: 0x0 Family: AF_INET (IPv4) IPv4 address 74.125.224.114 Socket type: SOCK_STREAM (stream) Protocol: IPPROTO_TCP (TCP) Length of this sockaddr: 16 Canonical name: (null) getaddrinfo response 2 Flags: 0x0 Family: AF_INET (IPv4) IPv4 address 74.125.224.113 Socket type: SOCK_STREAM (stream) Protocol: IPPROTO_TCP (TCP) Length of this sockaddr: 16 Canonical name: (null) getaddrinfo response 3 Flags: 0x0 Family: AF_INET (IPv4) IPv4 address 74.125.224.116 Socket type: SOCK_STREAM (stream) Protocol: IPPROTO_TCP (TCP) Length of this sockaddr: 16 Canonical name: (null) getaddrinfo response 4 Flags: 0x0 Family: AF_INET (IPv4) IPv4 address 74.125.224.115 Socket type: SOCK_STREAM (stream) Protocol: IPPROTO_TCP (TCP) Length of this sockaddr: 16 Canonical name: (null) getaddrinfo response 5 Flags: 0x0 Family: AF_INET (IPv4) IPv4 address 74.125.224.112 Socket type: SOCK_STREAM (stream) Protocol: IPPROTO_TCP (TCP) Length of this sockaddr: 16 Canonical name: (null) Press any key to continue . . . |
www.google.com 도메인이 지칭하는 아이피 주소들 중에 하나씩 접속을 시도해보기 위한 코드였습니다.
참고로 www.google.com 의 domain 정보는
C:\>nslookup www.google.com Address: 10.1.100.10 Non-authoritative answer: Name: www.google.com Addresses: 2607:f8b0:4005:802::1011 74.125.224.113 74.125.224.116 74.125.224.115 74.125.224.112 74.125.224.114 |
[GIT] PuttyKey 로 접속할때 Load PuttyKey 가 활성화 되지 않을때..
Git 의 설정에서 ssh 클라이언트의 경로가 잘못되어서 발생하는 문제.
TortoiseGit ->Settings -> Network 창 표시
SSH 클라이언트 설정을
C:\Program Files\TortoiseGit\bin\TortoiseGitPLink.exe
으로 설정.
[C++] std::cout 에 hex 로? oct 로?
#include <iostream> #include <sstream> int main() { std::cout << "The number 42 in octal: " << std::oct << 42 << '\n' << "The number 42 in decimal: " << std::dec << 42 << '\n' << "The number 42 in hex: " << std::hex << 42 << '\n'; int n; std::istringstream("2A") >> std::hex >> n; std::cout << std::dec << "Parsing \"2A\" as hex gives " << n << '\n'; }
이벤트 로그 한방에 삭제하기
for /F "tokens=*" %1 in ('wevtutil.exe el') DO wevtutil.exe cl "%1"
[tool] 하드 파일/폴더별 용량을 면적으로 표시하자..SpaceSniffer
[VC] socket id(Descriptor) 에서 연결정보 알아내기
wchar_t host[128];
memset(host,0,sizeof(host));
unsigned long dwHostLen = _countof(host);
struct sockaddr_storage addr;
int addr_len = sizeof(addr);
//if(getsockname(s, (struct sockaddr*)&addr, &addr_len) == SOCKET_ERROR) // 내 아이피/포트
if(getpeername(s, (struct sockaddr*)&addr, &addr_len) == SOCKET_ERROR) // 상대방 아이피/포트
{
MyTraceW(L"getsockname error %ld", WSAGetLastError());
}
else
{
WSAAddressToStringW((LPSOCKADDR)&addr, addr_len, NULL, host, &dwHostLen);
MyTraceW(L"send called s[%d] %X %ld bytes. to %s", (unsigned int)s, buf, len, host);
}
어떨때 쓰냐면 send 훅 한담에 소캣별로 패킷을 구분하고 싶을때
vhd 용량 줄이기
- Start the guest PC, and then defragment the guest PC hard disk.
- Obtain and then install a third-party data removal utility on the guest PC operating system.
- Run the third-party utility in the guest PC, and then configure it to zero out unused disk space. Use sdelete
- When this operation is complete, shut down the guest PC.
If you use "undoable" virtual hard disk images, commit the changes to the virtual hard disks. - In Virtual PC, click Virtual Disk Wizard on the File menu.
- Click Next, click Examine or modify existing disk image, and then click Next.
- Click Browse, locate and then click the virtual hard disk image that you want to compact, click Open, and then click Next.
- Click Compact the disk image, and then click Next.
- Use one of the following methods to create a compacted disk image:
- Click Use original file.
When you use this method, the virtual hard disk image is compacted to the same file as the original virtual hard disk image. This method uses less disk space on the host computer. However, if the virtual hard disk file becomes corrupted during the compaction process, you may lose guest PC data. - Click Select new file, click Browse, type a new file name for this virtual hard disk image, and then click Save.
When you use this method, a new image file is created for the compacted virtual hard disk image. Because the original file is not overwritten during the compaction process, Microsoft recommends that you use this method. When you use this method, you can verify the integrity of the guest PC virtual hard disk before you have to remove the original virtual hard disk image.
- Click Use original file.
- Click Next, and then click Finish.
The virtual hard disk is compacted. - On the message that states that the hard disk was compacted successfully, click Close.
The third-party products that this article discusses are manufactured by companies that are independent of Microsoft. Microsoft makes no warranty, implied or otherwise, regarding the performance or reliability of these products.
VitualBox 에서 용량줄이기.
1~4번까지 그대로 수행
오라클설치폴더\VBoxManage modyfyhd Win.vdi --compact
끝!
클래스 멤버 함수포인트 얻는 방법?
[Type1]
typedef void (CClientSocket::*TSendPacket)(const CprintPacket&);
TSendPacket lpSendPacket = (TSendPacket)&CClientSocket::SendPacket;
PDWORD pSendPacket = (PDWORD)&lpSendPacket;
pSendPacket = (PDWORD)*pSendPacket;
[Type2]
template <class T1, class T2>
T1 union_cast(T2 v)
{
static_assert(sizeof(T1) >= sizeof(T2), "Bad union_cast!");
union UT {T1 t1; T2 t2;} u;
u.t2 = v;
return u.t1;
}
class MyClass
{
public:
void foo(int);
};
auto p = union_cast<void *>(&MyClass::foo);
[Type3]
void *DisMember(size_t size, ...)
{
if (size != sizeof(void *)) return NULL;
va_list args;
va_start(args, size);
void *res = va_arg(args, void *);
va_end(args);
return res;
}
// snip
void Base::MyMethod() { /* ... */ }
// snip
void *anything = DisMember(sizeof(void (Base::*)()), &Base::MyMethod);
[Type4]
LPVOID pVoid;
__asm
{
push eax
mov eax, CPatternSearch::BytePatternSearch
mov pVoid, eax
pop eax
}
콘솔에 색깔을 입혀보자..
HANDLE hConsoleW, hConsoleR;
enum Color { black = 0, blue, green, cyan, red, purple, yellow, grey, dgrey, lblue, lgreen, lcyan, lred, lpurple, lyellow, white};
AllocConsole();
SetConsoleTitle(_T("Some title"));
hConsoleW = GetStdHandle(STD_OUTPUT_HANDLE);
hConsoleR = GetStdHandle(STD_INPUT_HANDLE);
void ConsoleOutput(TCHAR* lpszMessage, Color color = white){
int len = wcslen(lpszMessage);
DWORD numOfCharWritten;
SetConsoleTextAttribute(hConsoleW, color);
WriteConsole(hConsoleW, lpszMessage, len, &numOfCharWritten, NULL);
}
구글 url 검색
site:combatarms.nexon.net inurl:test
[VC] 파일 드래그앤드롭 (Drag Drop)
- 프로그램의 초기화시에 DragAcceptFiles(hWnd, TRUE) 함수를 호출한다. 첫 번째 인자인 hWnd는 드롭의 타겟이 되는 윈도우의 핸들이다.
혹은 다이얼로그(윈도우)의 리소스에서 Accept Files 을 true로 둔다. 탐색기로부터 파일이 드롭되는 순간에 WM_DROPFILES 메시지가 날라온다. 이를 처리한다.
혹은 해당 다이얼로드(윈도우)의 클래스에서 WM_DROPFILES 를 재정의한다.case WM_DROPFILES : { POINT pt; // 어느 위치에 드롭되었는지 그 항목을 알아낸다. if (DragQueryPoint((HDROP)wParam, &pt)) { UINT i = 0; // 모두 몇 개의 파일이 드롭되었는지 알아낸다. // 만일 폴더가 드롭되었다면 폴더의 이름만 넘어온다. UINT uCount = DragQueryFile((HDROP)wParam, 0xFFFFFFFF, NULL ,0); for(i = 0;i < uCount;i++) { // 드롭된 파일의 이름을 알아온다. DragQueryFile((HDROP)wParam, i, buffer ,255); // 드롭된 파일 이름을 출력해본다. MessageBox(hWnd, buffer, "File Name", MB_OK); } } // drag and drop 작업을 끝낸다. DragFinish((HDROP)wParam); break; }
- Drag&drop을 더 사용할 필요가 없어지면 DragAcceptFiles를 호출한다.
DragAcceptFiles(hWnd, FALSE);
이번주말에!!!!!
좋~~다~!
잔잔하구만.
USB/CD 자동실행 방지
services.msc -> Shell Hardware Detection -> 사용안함
gpedit.msc -> Computer Configuration -> Administrative Template -> Windows Components -> AutoPlay Policies -> Turn Off Autoplay 실행 -> Enable 설정 -> 모든드라이브
해외에서 운전경력증 발급하기
해외에서 직접 발급은 불가능합니다. 지인에게 부탁하세요.
--------------------------------------------------------------------------
운전경력증명서는 국문및 영문으로 발급하여 드리고 있으며,
인터넷 발급은 공인인증이 필요하며
“민원24”홈페이지(www.minwon.go.kr)를 통해 24시간 발급이 가능하며, 토,일,공휴일 가능, 수수료는 무료입니다.
다만, 영문운전경력증명서는 인터넷발급은 불가하며 가까운 경찰서 민원실을 방문 발급받으시기 바랍니다.
아울러, 본인이 부득이한 사정으로 대리인으로 하여금 신청시,
본인(위임자)의 신분증 사본, 위임장, 대리인 신분증 등을 지참.
* 해외에서 대리인 신청시 본인의 운전면허증 또는 신분증 사본, 여권사본,등을 이메일로 국내의 대리인에게 보내면 출력후 관할서에서 영문경력증명서 발급 가능
* 해외에서 대리인 신청시 fax가능,
* 위임장은 도로교통공단 홈페이지(http://www.koroad.or.kr)운전면허→자료쎈터→면허민원서식→38 위임장(해외체류자용)에서 다운받아서 사용하시면 되고, 양식이 없을 시에는 A4용지에 위임하는 사람과 대리인의 성명, 주민번호, 주소, 전화번호를 기재한후 "운전경력증명서 발급을 위임한다" 라는 내용과 함께 년,월,일, 그리고 서명을 하시면 됩니다.
이밖에 운전경력증명서 관련 궁금하신 사항은 교통기획과 운전면허계 02-3150-2650로 전화주시면 성심껏 답변 드리겠습니다. 감사합니다.
--------------------------------------------------------------------------
아.. 짜증나기 시작했다...
티스토리 댓글 도배 좀 어떻게 안되나?
휴~ 댓글에 캡차 적용해야하나...
특정 아이피에서 하루에 덧글 몇개 이상이면 캡차 자동적용이라도 좀 시켜!!!!
[VC] 하나의 솔루션에 여러개의 프로젝트 디버깅(서버 클라 구조)
하나의 솔루션에 여러개의 프로젝트로 작업을 할 때가 있습니다.
독입된 프로젝트로 동작한다면 디버깅에 문제는 없지만 만일 서버-클라이언트 구조라면 어떻게 해야할까요?
VC 를 서버용, 클라용 두개를 띄워서 작업한다?
그렇게만 되면 오히려 더 깔끔할것 같긴합니다. (이건 혹시나 방법이 있을지도 모르겠네요)
PC를 2대로 테스트한다? 이건 더 좋은 방법이겠죠. (소스 통합은 형상관리툴로 하고..)
하지만 그런 상황이 안된다면 아래와 같은 방법으로 하나의 VS로 모두 디버깅을 할 수 있습니다.
솔루션 -> 속성 -> 시작 프로젝트 -> Multiple startup project 선택
동시에 실행시킬 프로젝트에 대해서 Action 의 값을 Start 로 변경시켜줍니다.
만일 프로젝트의 실행 순서가 있다면 오른쪽 화살표로 순서를 변경시켜줍니다.
저같은 경우 서버를 먼저 실행시키고, 클라이언트를 나중에 실행시키도록 설정하였습니다.
그럼 이만~!
[VC] The project is out of date: <= 짲응.
* 삭제된 헤더파일이 프로젝트에 포함되어 있는 경우
* Debug 폴더를 날린다.
* Clean 을 한다..
등등 어떤짓을 하면 해결된다는데 난 안되는군.
일단 리서치중.
[C++] CreateProcess Access violation error
약 한시간 가량 빡치게 만든에러..
MS 는 CreateProcess 의 버그를 고칠 생각이 없는가? 구조적으로 힘든가? 아무튼 이런 빡치는 상황이 발생하면 아래와 같이 수정하세요.
먼저 CreateProcess 를 사용하는 수천만명이 봤을 간단한 예제를 봅시다.
http://msdn.microsoft.com/en-us/library/windows/desktop/ms682512(v=vs.85).aspx
빨간 부분을 수정했습니다.
#include <windows.h> #include <stdio.h> #include <tchar.h> void _tmain( int argc, TCHAR *argv[] ) { STARTUPINFO si; PROCESS_INFORMATION pi; ZeroMemory( &si, sizeof(si) ); si.cb = sizeof(si); ZeroMemory( &pi, sizeof(pi) ); if( argc != 2 ) { printf("Usage: %s [cmdline]\n", argv[0]); return; } // Start the child process. if( !CreateProcess( NULL, // No module name (use command line) _T("notepad.exe"), // Command line NULL, // Process handle not inheritable NULL, // Thread handle not inheritable FALSE, // Set handle inheritance to FALSE 0, // No creation flags NULL, // Use parent's environment block NULL, // Use parent's starting directory &si, // Pointer to STARTUPINFO structure &pi ) // Pointer to PROCESS_INFORMATION structure ) { printf( "CreateProcess failed (%d).\n", GetLastError() ); return; } // Wait until child process exits. WaitForSingleObject( pi.hProcess, INFINITE ); // Close process and thread handles. CloseHandle( pi.hProcess ); CloseHandle( pi.hThread ); }
이렇게 한 뒤에 unicode 로 빌드하면 빡치는 상황이 발생합니다. 바로 Access violation error!!!!!!!!!!!!
그 원인은 unicode 버전의 createprocess 는 lpCommandLine 파라미터를 변경시키기 때문에 const 메모리 주소를 전달하면 안됩니다.
아래 msdn 에 설명되어 있습니다.
The command line to be executed. The maximum length of this string is 32,768 characters, including the Unicode terminating null character. If lpApplicationName is NULL, the module name portion of lpCommandLine is limited to MAX_PATH characters.
The Unicode version of this function, CreateProcessW, can modify the contents of this string. Therefore, this parameter cannot be a pointer to read-only memory (such as a const variable or a literal string). If this parameter is a constant string, the function may cause an access violation.
The lpCommandLine parameter can be NULL. In that case, the function uses the string pointed to bylpApplicationName as the command line.
If both lpApplicationName and lpCommandLine are non-NULL, the null-terminated string pointed to bylpApplicationName specifies the module to execute, and the null-terminated string pointed to by lpCommandLinespecifies the command line. The new process can use GetCommandLine to retrieve the entire command line. Console processes written in C can use the argc and argv arguments to parse the command line. Because argv[0] is the module name, C programmers generally repeat the module name as the first token in the command line.
[VC++] 컴퓨터 이름 알아내기.
int get_computer_name(BYTE *computer_name, DWORD *computer_name_lg)
{
HKEY hKey;
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE,
"SYSTEM\\CurrentControlSet\\Control\\ComputerName\\ComputerName",
0, KEY_QUERY_VALUE, &hKey ) != ERROR_SUCCESS)
return FALSE;
if (RegQueryValueEx(hKey, "ComputerName", NULL, NULL,
(LPBYTE) computer_name,
(LPDWORD) computer_name_lg) != ERROR_SUCCESS) {
RegCloseKey(hKey);
return FALSE;
}
RegCloseKey(hKey);
return TRUE;
}
테스트는 안해봄.