From 5e85f48b85b54342b8bb472c10c5593abbb8b1eb Mon Sep 17 00:00:00 2001 From: Rozhuk Ivan Date: Sun, 14 Dec 2014 12:43:21 +0000 Subject: mra: w4 fixs git-svn-id: http://svn.miranda-ng.org/main/trunk@11401 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/MRA/src/MraProto.h | 10 +-- protocols/MRA/src/Mra_functions.cpp | 152 ++++++++++++++++++----------------- protocols/MRA/src/Mra_svcs.cpp | 7 +- protocols/MRA/src/Sdk/InternetTime.h | 42 +++++----- protocols/MRA/src/Sdk/timefuncs.h | 14 ++++ 5 files changed, 121 insertions(+), 104 deletions(-) (limited to 'protocols/MRA') diff --git a/protocols/MRA/src/MraProto.h b/protocols/MRA/src/MraProto.h index aa076c20ec..d6183d92f7 100644 --- a/protocols/MRA/src/MraProto.h +++ b/protocols/MRA/src/MraProto.h @@ -211,11 +211,11 @@ struct CMraProto : public PROTO DWORD MraAuthorize(const CMStringA &szEmail); DWORD MraChangeStatus(DWORD dwStatus, const CMStringA &szStatusUri, const CMStringW &wszStatusTitle, const CMStringW &wszStatusDesc, DWORD dwFutureFlags); DWORD MraFileTransfer(const CMStringA &szEmail, DWORD dwIdRequest, DWORD dwFilesTotalSize, const CMStringW &lpwszFiles, const CMStringA &szAddresses); - DWORD MraFileTransferAck(DWORD dwStatus, const CMStringA &szEmail, DWORD dwIdRequest, const CMStringA &szDescription); + DWORD MraFileTransferAck(DWORD dwStatus, const CMStringA &szEmail, DWORD dwIdRequest, LPBYTE lpbDescription, size_t dwDescriptionSize); HANDLE MraWPRequestW(MCONTACT hContact, DWORD dwAckType, DWORD dwRequestFlags, const CMStringA &szUser, const CMStringA &szDomain, const CMStringW &wszNickName, const CMStringW &wszFirstName, const CMStringW &wszLastName, DWORD dwSex, DWORD dwDate1, DWORD dwDate2, DWORD dwCityID, DWORD dwZodiak, DWORD dwBirthdayMonth, DWORD dwBirthdayDay, DWORD dwCountryID, DWORD dwOnline); HANDLE MraWPRequestByEMail(MCONTACT hContact, DWORD dwAckType, CMStringA &szEmail); DWORD MraGame(const CMStringA &szEmail, DWORD dwGameSessionID, DWORD dwGameMsg, DWORD dwGameMsgID, const CMStringA &lpszData); - DWORD MraLogin2W(const CMStringA &szLogin, const CMStringA &szPassword, DWORD dwStatus, const CMStringA &szStatusUri, CMStringW &wszStatusTitle, CMStringW &wszStatusDesc, DWORD dwFutureFlags, CMStringA &szUserAgentFormatted, CMStringA &szUserAgent); + DWORD MraLogin2W(CMStringA &szLogin, CMStringA &szPassword, DWORD dwStatus, CMStringA &szStatusUri, CMStringW &wszStatusTitle, CMStringW &wszStatusDesc, DWORD dwFutureFlags, CMStringA &szUserAgentFormatted, CMStringA &szUserAgent); DWORD MraSMSW(MCONTACT hContact, const CMStringA &lpszPhone, const CMStringW &lpwszMessage); DWORD MraProxy(const CMStringA &szEmail, DWORD dwIDRequest, DWORD dwDataType, const CMStringA &lpszData, const CMStringA &szAddresses, MRA_GUID mguidSessionID); DWORD MraProxyAck(DWORD dwStatus, const CMStringA &szEmail, DWORD dwIDRequest, DWORD dwDataType, const CMStringA &lpszData, const CMStringA &szAddresses, MRA_GUID mguidSessionID); @@ -249,7 +249,7 @@ struct CMraProto : public PROTO DWORD MraSetContactStatus(MCONTACT hContact, DWORD dwNewStatus); DWORD MraContactCapabilitiesGet(MCONTACT hContact); void MraContactCapabilitiesSet(MCONTACT hContact, DWORD dwFutureFlags); - void MraUpdateEmailStatus(const CMStringA &szFrom, const CMStringA &szSubject, bool force_display); + void MraUpdateEmailStatus(const CMStringA &szFrom, const CMStringA &szSubject, DWORD dwDate, DWORD dwUIDL, bool force_display); DWORD MraConvertToRTFW(const CMStringW &wszMessage, CMStringA &szMessageRTF); DWORD StartConnect(); @@ -341,8 +341,8 @@ struct CMraProto : public PROTO void MraAvatarsSetContactTime (MCONTACT hContact, LPSTR lpszValueName, SYSTEMTIME *pstTime); DWORD MraAvatarsGetFileName(HANDLE hAvatarsQueueHandle, MCONTACT hContact, DWORD dwFormat, CMStringW &res); DWORD MraAvatarsQueueGetAvatar(HANDLE hAvatarsQueueHandle, DWORD dwFlags, MCONTACT hContact, DWORD *pdwAvatarsQueueID, DWORD *pdwFormat, LPTSTR lpszPath); - DWORD MraAvatarsQueueGetAvatarSimple(HANDLE hAvatarsQueueHandle, DWORD dwFlags, MCONTACT hContact); - DWORD MraAvatarsDeleteContactAvatarFile(HANDLE hAvatarsQueueHandle, MCONTACT hContact); + DWORD MraAvatarsQueueGetAvatarSimple(HANDLE hAvatarsQueueHandle, DWORD dwFlags, MCONTACT hContact); + DWORD MraAvatarsDeleteContactAvatarFile(HANDLE hAvatarsQueueHandle, MCONTACT hContact); void __cdecl MraAvatarsThreadProc(LPVOID lpParameter); }; diff --git a/protocols/MRA/src/Mra_functions.cpp b/protocols/MRA/src/Mra_functions.cpp index 11f3e8d2a2..154eed96dc 100644 --- a/protocols/MRA/src/Mra_functions.cpp +++ b/protocols/MRA/src/Mra_functions.cpp @@ -29,10 +29,10 @@ LRESULT CALLBACK MessageEditSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPA CMStringA MraGetSelfVersionString() { WORD v[4]; - CallService(MS_SYSTEM_GETFILEVERSION, 0, (LPARAM)v); - LPSTR lpszSecIM = ServiceExists("SecureIM/IsContactSecured") ? " + SecureIM" : ""; + LPSTR lpszSecIM = ServiceExists("SecureIM/IsContactSecured") ? " + SecureIM" : ""; CMStringA szSelfVersion; + CallService(MS_SYSTEM_GETFILEVERSION, 0, (LPARAM)v); szSelfVersion.Format("Miranda NG %lu.%lu.%lu.%lu Unicode (MRA v%lu.%lu.%lu.%lu)%s, version: %lu.%lu", v[0], v[1], v[2], v[3], __FILEVERSION_STRING, lpszSecIM, PROTO_VERSION_MAJOR, PROTO_VERSION_MINOR); return szSelfVersion; @@ -631,7 +631,7 @@ DWORD CMraProto::MraSetContactStatus(MCONTACT hContact, DWORD dwNewStatus) return dwOldStatus; } -void CMraProto::MraUpdateEmailStatus(const CMStringA &pszFrom, const CMStringA &pszSubject, bool force_display) +void CMraProto::MraUpdateEmailStatus(const CMStringA &pszFrom, const CMStringA &pszSubject, DWORD dwDate, DWORD dwUIDL, bool force_display) { BOOL bTrayIconNewMailNotify; WCHAR szStatusText[MAX_SECONDLINE]; @@ -1142,9 +1142,10 @@ INT_PTR CALLBACK SendReplyBlogStatusDlgProc(HWND hWndDlg, UINT message, WPARAM w { DWORD dwFlags; DWORDLONG dwBlogStatusID; - TCHAR szBuff[MICBLOG_STATUS_MAX]; + GetDlgItemText(hWndDlg, IDC_MSG_TO_SEND, szBuff, SIZEOF(szBuff)); + if (dat->hContact) { dwFlags = (MRIM_BLOG_STATUS_REPLY | MRIM_BLOG_STATUS_NOTIFY); @@ -1156,7 +1157,8 @@ INT_PTR CALLBACK SendReplyBlogStatusDlgProc(HWND hWndDlg, UINT message, WPARAM w } else { dwFlags = MRIM_BLOG_STATUS_UPDATE; - if (IsDlgButtonChecked(hWndDlg, IDC_CHK_NOTIFY)) dwFlags |= MRIM_BLOG_STATUS_NOTIFY; + if (IsDlgButtonChecked(hWndDlg, IDC_CHK_NOTIFY)) + dwFlags |= MRIM_BLOG_STATUS_NOTIFY; dwBlogStatusID = 0; } dat->ppro->MraChangeUserBlogStatus(dwFlags, szBuff, dwBlogStatusID); @@ -1224,83 +1226,85 @@ DWORD GetYears(CONST PSYSTEMTIME pcstSystemTime) DWORD FindFile(LPWSTR lpszFolder, DWORD dwFolderLen, LPWSTR lpszFileName, DWORD dwFileNameLen, LPWSTR lpszRetFilePathName, DWORD dwRetFilePathLen, DWORD *pdwRetFilePathLen) { - if (!lpszFolder || !dwFolderLen || !lpszFileName || !dwFileNameLen) - return ERROR_INVALID_HANDLE; - - TCHAR szPath[32768]; - DWORD dwPathLen, dwRecDeepAllocated, dwRecDeepCurPos, dwFilePathLen; - RECURSION_DATA_STACK_ITEM *prdsiItems; - - if (dwFolderLen == -1) dwFolderLen = mir_wstrlen(lpszFolder); - if (dwFileNameLen == -1) dwFileNameLen = mir_wstrlen(lpszFileName); - - dwRecDeepCurPos = 0; - dwRecDeepAllocated = RECURSION_DATA_STACK_ITEMS_MIN; - prdsiItems = (RECURSION_DATA_STACK_ITEM*)mir_calloc(dwRecDeepAllocated*sizeof(RECURSION_DATA_STACK_ITEM)); - if (prdsiItems == NULL) - return GetLastError(); - - DWORD dwRetErrorCode = ERROR_FILE_NOT_FOUND; - dwPathLen = dwFolderLen; - memcpy(szPath, lpszFolder, (dwPathLen*sizeof(WCHAR))); - if (szPath[(dwPathLen - 1)] != '\\') { - szPath[dwPathLen] = '\\'; - dwPathLen++; - } - szPath[dwPathLen] = 0; - mir_tstrcat(szPath, _T("*.*")); - - prdsiItems[dwRecDeepCurPos].dwFileNameLen = 0; - prdsiItems[dwRecDeepCurPos].hFind = FindFirstFileEx(szPath, FindExInfoStandard, &prdsiItems[dwRecDeepCurPos].w32fdFindFileData, FindExSearchNameMatch, NULL, 0); - if (prdsiItems[dwRecDeepCurPos].hFind != INVALID_HANDLE_VALUE) { - do { - dwPathLen -= prdsiItems[dwRecDeepCurPos].dwFileNameLen; - - while (dwRetErrorCode == ERROR_FILE_NOT_FOUND && FindNextFile(prdsiItems[dwRecDeepCurPos].hFind, &prdsiItems[dwRecDeepCurPos].w32fdFindFileData)) { - if (prdsiItems[dwRecDeepCurPos].w32fdFindFileData.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY) {// folder - if (CompareString(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), NORM_IGNORECASE, prdsiItems[dwRecDeepCurPos].w32fdFindFileData.cFileName, -1, _T("."), 1) != CSTR_EQUAL) - if (CompareString(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), NORM_IGNORECASE, prdsiItems[dwRecDeepCurPos].w32fdFindFileData.cFileName, -1, _T(".."), 2) != CSTR_EQUAL) { - prdsiItems[dwRecDeepCurPos].dwFileNameLen = (mir_wstrlen(prdsiItems[dwRecDeepCurPos].w32fdFindFileData.cFileName) + 1); - memcpy((szPath + dwPathLen), prdsiItems[dwRecDeepCurPos].w32fdFindFileData.cFileName, (prdsiItems[dwRecDeepCurPos].dwFileNameLen*sizeof(WCHAR))); - mir_tstrcat(szPath, _T("\\*.*")); - dwPathLen += prdsiItems[dwRecDeepCurPos].dwFileNameLen; - - dwRecDeepCurPos++; - if (dwRecDeepCurPos == dwRecDeepAllocated) { // need more space - dwRecDeepAllocated += RECURSION_DATA_STACK_ITEMS_MIN; - prdsiItems = (RECURSION_DATA_STACK_ITEM*)mir_realloc(prdsiItems, dwRecDeepAllocated*sizeof(RECURSION_DATA_STACK_ITEM)); - if (prdsiItems == NULL) { - dwRecDeepCurPos = 0; - dwRetErrorCode = GetLastError(); - break; + DWORD dwRetErrorCode; + + if (lpszFolder && dwFolderLen && lpszFileName && dwFileNameLen) { + TCHAR szPath[32768]; + DWORD dwPathLen, dwRecDeepAllocated, dwRecDeepCurPos, dwFilePathLen; + RECURSION_DATA_STACK_ITEM *prdsiItems; + + if (dwFolderLen == -1) dwFolderLen = mir_wstrlen(lpszFolder); + if (dwFileNameLen == -1) dwFileNameLen = mir_wstrlen(lpszFileName); + + dwRecDeepCurPos = 0; + dwRecDeepAllocated = RECURSION_DATA_STACK_ITEMS_MIN; + prdsiItems = (RECURSION_DATA_STACK_ITEM*)mir_calloc(dwRecDeepAllocated*sizeof(RECURSION_DATA_STACK_ITEM)); + if (prdsiItems) { + dwPathLen = dwFolderLen; + memcpy(szPath, lpszFolder, (dwPathLen*sizeof(WCHAR))); + if (szPath[(dwPathLen - 1)] != '\\') { + szPath[dwPathLen] = '\\'; + dwPathLen++; + } + szPath[dwPathLen] = 0; + mir_tstrcat(szPath, _T("*.*")); + + prdsiItems[dwRecDeepCurPos].dwFileNameLen = 0; + prdsiItems[dwRecDeepCurPos].hFind = FindFirstFileEx(szPath, FindExInfoStandard, &prdsiItems[dwRecDeepCurPos].w32fdFindFileData, FindExSearchNameMatch, NULL, 0); + if (prdsiItems[dwRecDeepCurPos].hFind != INVALID_HANDLE_VALUE) { + dwRetErrorCode = ERROR_FILE_NOT_FOUND; + do { + dwPathLen -= prdsiItems[dwRecDeepCurPos].dwFileNameLen; + + while (dwRetErrorCode == ERROR_FILE_NOT_FOUND && FindNextFile(prdsiItems[dwRecDeepCurPos].hFind, &prdsiItems[dwRecDeepCurPos].w32fdFindFileData)) { + if (prdsiItems[dwRecDeepCurPos].w32fdFindFileData.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY) {// folder + if (CompareString(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), NORM_IGNORECASE, prdsiItems[dwRecDeepCurPos].w32fdFindFileData.cFileName, -1, _T("."), 1) != CSTR_EQUAL) + if (CompareString(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), NORM_IGNORECASE, prdsiItems[dwRecDeepCurPos].w32fdFindFileData.cFileName, -1, _T(".."), 2) != CSTR_EQUAL) { + prdsiItems[dwRecDeepCurPos].dwFileNameLen = (mir_wstrlen(prdsiItems[dwRecDeepCurPos].w32fdFindFileData.cFileName) + 1); + memcpy((szPath + dwPathLen), prdsiItems[dwRecDeepCurPos].w32fdFindFileData.cFileName, (prdsiItems[dwRecDeepCurPos].dwFileNameLen*sizeof(WCHAR))); + mir_tstrcat(szPath, _T("\\*.*")); + dwPathLen += prdsiItems[dwRecDeepCurPos].dwFileNameLen; + + dwRecDeepCurPos++; + if (dwRecDeepCurPos == dwRecDeepAllocated) { // need more space + dwRecDeepAllocated += RECURSION_DATA_STACK_ITEMS_MIN; + prdsiItems = (RECURSION_DATA_STACK_ITEM*)mir_realloc(prdsiItems, dwRecDeepAllocated*sizeof(RECURSION_DATA_STACK_ITEM)); + if (prdsiItems == NULL) { + dwRecDeepCurPos = 0; + dwRetErrorCode = GetLastError(); + break; + } + } + prdsiItems[dwRecDeepCurPos].hFind = FindFirstFileEx(szPath, FindExInfoStandard, &prdsiItems[dwRecDeepCurPos].w32fdFindFileData, FindExSearchNameMatch, NULL, 0); } } - prdsiItems[dwRecDeepCurPos].hFind = FindFirstFileEx(szPath, FindExInfoStandard, &prdsiItems[dwRecDeepCurPos].w32fdFindFileData, FindExSearchNameMatch, NULL, 0); - } - } - else {// file - if (CompareString(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), NORM_IGNORECASE, prdsiItems[dwRecDeepCurPos].w32fdFindFileData.cFileName, -1, lpszFileName, dwFileNameLen) == CSTR_EQUAL) { - prdsiItems[dwRecDeepCurPos].dwFileNameLen = mir_wstrlen(prdsiItems[dwRecDeepCurPos].w32fdFindFileData.cFileName); - memcpy((szPath + dwPathLen), prdsiItems[dwRecDeepCurPos].w32fdFindFileData.cFileName, ((prdsiItems[dwRecDeepCurPos].dwFileNameLen + 1)*sizeof(WCHAR))); - dwFilePathLen = (dwPathLen + prdsiItems[dwRecDeepCurPos].dwFileNameLen); - - if (pdwRetFilePathLen) (*pdwRetFilePathLen) = dwFilePathLen; - if (lpszRetFilePathName && dwRetFilePathLen) { - dwFilePathLen = min(dwFilePathLen, dwRetFilePathLen); - memcpy(lpszRetFilePathName, szPath, ((dwFilePathLen + 1)*sizeof(WCHAR))); + else {// file + if (CompareString(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), NORM_IGNORECASE, prdsiItems[dwRecDeepCurPos].w32fdFindFileData.cFileName, -1, lpszFileName, dwFileNameLen) == CSTR_EQUAL) { + prdsiItems[dwRecDeepCurPos].dwFileNameLen = mir_wstrlen(prdsiItems[dwRecDeepCurPos].w32fdFindFileData.cFileName); + memcpy((szPath + dwPathLen), prdsiItems[dwRecDeepCurPos].w32fdFindFileData.cFileName, ((prdsiItems[dwRecDeepCurPos].dwFileNameLen + 1)*sizeof(WCHAR))); + dwFilePathLen = (dwPathLen + prdsiItems[dwRecDeepCurPos].dwFileNameLen); + + if (pdwRetFilePathLen) (*pdwRetFilePathLen) = dwFilePathLen; + if (lpszRetFilePathName && dwRetFilePathLen) { + dwFilePathLen = min(dwFilePathLen, dwRetFilePathLen); + memcpy(lpszRetFilePathName, szPath, ((dwFilePathLen + 1)*sizeof(WCHAR))); + } + + dwRetErrorCode = NO_ERROR; + } } - - dwRetErrorCode = NO_ERROR; } + + if (prdsiItems) FindClose(prdsiItems[dwRecDeepCurPos].hFind); + dwRecDeepCurPos--; } + while (dwRecDeepCurPos != -1); } - - if (prdsiItems) FindClose(prdsiItems[dwRecDeepCurPos].hFind); - dwRecDeepCurPos--; + mir_free(prdsiItems); } - while (dwRecDeepCurPos != -1); + else dwRetErrorCode = GetLastError(); } - mir_free(prdsiItems); + else dwRetErrorCode = ERROR_INVALID_HANDLE; return dwRetErrorCode; } diff --git a/protocols/MRA/src/Mra_svcs.cpp b/protocols/MRA/src/Mra_svcs.cpp index 3c34bdb147..e27035996f 100644 --- a/protocols/MRA/src/Mra_svcs.cpp +++ b/protocols/MRA/src/Mra_svcs.cpp @@ -589,25 +589,20 @@ INT_PTR CMraProto::GetUnreadEmailCount(WPARAM, LPARAM) INT_PTR CMraProto::MraGetAvatarCaps(WPARAM wParam, LPARAM) { + switch (wParam) { case AF_MAXSIZE: return -1; - case AF_PROPORTION: return PIP_NONE; - case AF_FORMATSUPPORTED: return 0; // no formats to set - case AF_ENABLED: return 1; // always on - case AF_DONTNEEDDELAYS: return 0; // need delay - case AF_MAXFILESIZE: return 0; - case AF_DELAYAFTERFAIL: return 5000; } diff --git a/protocols/MRA/src/Sdk/InternetTime.h b/protocols/MRA/src/Sdk/InternetTime.h index 8052bb9ea6..d1bd7e50aa 100644 --- a/protocols/MRA/src/Sdk/InternetTime.h +++ b/protocols/MRA/src/Sdk/InternetTime.h @@ -129,31 +129,35 @@ __inline CMStringA InternetTimeGetString(INTERNET_TIME *pitTime) { char lpszBuff[100]; LPSTR lpszCurPos = lpszBuff; - size_t dwTimeLen=0,dwtm; + size_t dwTimeLen = 0, dwtm; // day of weak// date of mounth// mounth name// year// hours // minutes// seconds - dwtm=wsprintfA(lpszCurPos,"%s, %02lu %s %04lu %02lu:%02lu:%02lu ",lpcszenmDayOfWeakEnum[pitTime->stTime.wDayOfWeek],pitTime->stTime.wDay,lpcszenmMonthEnum[pitTime->stTime.wMonth],pitTime->stTime.wYear,pitTime->stTime.wHour,pitTime->stTime.wMinute,pitTime->stTime.wSecond); - lpszCurPos+=dwtm; - dwTimeLen+=dwtm; + dwtm = wsprintfA(lpszCurPos, "%s, %02lu %s %04lu %02lu:%02lu:%02lu ", + lpcszenmDayOfWeakEnum[pitTime->stTime.wDayOfWeek], + pitTime->stTime.wDay, + lpcszenmMonthEnum[pitTime->stTime.wMonth], + pitTime->stTime.wYear, + pitTime->stTime.wHour, + pitTime->stTime.wMinute, + pitTime->stTime.wSecond); + lpszCurPos += dwtm; + dwTimeLen += dwtm; // time zone - if (pitTime->lTimeZone) - { - if (pitTime->lTimeZone < 0) - {// нужно добавить плюсик, минус добавляется автоматом - (*((BYTE*)lpszCurPos))='+'; - lpszCurPos++; - dwTimeLen++; + if (pitTime->lTimeZone) { + if (pitTime->lTimeZone < 0) { // нужно добавить плюсик, минус добавляется автоматом + (*((BYTE*)lpszCurPos)) = '+'; + lpszCurPos ++; + dwTimeLen ++; } - dwtm=wsprintfA(lpszCurPos,"%04ld",-(((pitTime->lTimeZone/60)*100)+pitTime->lTimeZone%60)); - lpszCurPos+=dwtm; - dwTimeLen+=dwtm; - } - else{ - dwtm=wsprintfA(lpszCurPos,"GMT"); - lpszCurPos+=dwtm; - dwTimeLen+=dwtm; + dwtm = wsprintfA(lpszCurPos, "%04ld", -(((pitTime->lTimeZone / 60) * 100) + pitTime->lTimeZone % 60)); + lpszCurPos += dwtm; + dwTimeLen += dwtm; + } else { + dwtm = wsprintfA(lpszCurPos, "GMT"); + lpszCurPos += dwtm; + dwTimeLen += dwtm; } return lpszBuff; diff --git a/protocols/MRA/src/Sdk/timefuncs.h b/protocols/MRA/src/Sdk/timefuncs.h index eaee4a7e80..0bff545803 100644 --- a/protocols/MRA/src/Sdk/timefuncs.h +++ b/protocols/MRA/src/Sdk/timefuncs.h @@ -51,6 +51,20 @@ typedef union { } FT; +inline __time32_t _time32(__time32_t *timeptr) +{ + __time64_t tim; + FT nt_time; + + GetSystemTimeAsFileTime(&(nt_time.ft_struct)); + tim=(__time64_t)((nt_time.ft_scalar-EPOCH_BIAS)/10000000i64); + if (tim > (__time64_t)(_MAX__TIME32_T)) tim=(__time64_t)(-1); + if (timeptr) *timeptr = (__time32_t)(tim);// store time if requested + +return(__time32_t)(tim); +} + + inline __time32_t MakeTime32FromLocalSystemTime(CONST PSYSTEMTIME pcstSystemTime) { __time64_t tim=0; -- cgit v1.2.3