diff options
Diffstat (limited to 'gtalkext/inbox.cpp')
-rw-r--r-- | gtalkext/inbox.cpp | 54 |
1 files changed, 22 insertions, 32 deletions
diff --git a/gtalkext/inbox.cpp b/gtalkext/inbox.cpp index 449cdde..9317fbc 100644 --- a/gtalkext/inbox.cpp +++ b/gtalkext/inbox.cpp @@ -210,38 +210,28 @@ struct OPEN_URL_HEADER { HANDLE FindNetUserHandle(LPCSTR acc)
{
- IJabberInterface *ji = getJabberApi(acc);
- if (!ji) return NULL;
-
- PBYTE m_psProto = *(PBYTE*)((PBYTE)ji + sizeof(*ji)); // see CJabberInterface in jabber_proto.h
-
- PHANDLE pResult = (PHANDLE)(m_psProto + // see CJabberProto in jabber_proto.h
- sizeof(PVOID) + // skip vtable ptr
- sizeof(PVOID) + // skip m_ThreadInfo
- SIZE_OF_JABBER_OPTIONS); // skip m_options
-
- //for (int i=0; i < 100; i++) {
- // __try {
- // if (GetNetlibHandleType(*pResult) == NLH_USER)
- // MessageBox(0, L"1", L"1", 0);
- // }
- // __except (EXCEPTION_EXECUTE_HANDLER){
- // AllocConsole();
- // }
- // pResult++;
- //}
-
- if (GetNetlibHandleType(*pResult) != NLH_USER)
- pResult += 4;
-
- if (GetNetlibHandleType(*pResult) != NLH_USER)
- pResult += 4;
-
- if (GetNetlibHandleType(*pResult) != NLH_USER)
- pResult += 4;
-
- assert(GetNetlibHandleType(*pResult) == NLH_USER);
- return *pResult;
+ IJabberInterface *ji = getJabberApi(acc);
+ if (!ji) return NULL;
+
+ PBYTE m_psProto = *(PBYTE*)((PBYTE)ji + sizeof(*ji)); // see CJabberInterface in jabber_proto.h
+
+ PHANDLE pResult = (PHANDLE)(m_psProto + // see CJabberProto in jabber_proto.h
+ sizeof(PVOID) + // skip vtable ptr
+ sizeof(PVOID) + // skip m_ThreadInfo
+ SIZE_OF_JABBER_OPTIONS); // skip m_options
+
+ for (int i=0; i < 100; i++) {
+ __try {
+ if (GetNetlibHandleType(*pResult) == NLH_USER)
+ break;
+ }
+ __except (EXCEPTION_EXECUTE_HANDLER){
+ }
+ pResult++;
+ }
+
+ assert(GetNetlibHandleType(*pResult) == NLH_USER);
+ return *pResult;
}
unsigned __stdcall OpenUrlThread(OPEN_URL_HEADER* data)
|