Return to Product.c CVS log | Up to [OMI] / omi / nits / sample |
File: [OMI] / omi / nits / sample / Product.c
(download)
Revision: 1.1, Mon Apr 20 17:19:54 2015 UTC (9 years, 2 months ago) by krisbash Branch: MAIN CVS Tags: OMI_1_0_8_2, OMI_1_0_8_1, HEAD OMI 1.0.8-1 |
//***************************************************************************** // Copyright (C) 2011 Microsoft Corporation // All rights reserved. //***************************************************************************** #ifndef HOOK_BUILD #define HOOK_BUILD #endif #ifdef _MSC_VER #include <sal.h> #include <windows.h> #include <strsafe.h> #endif #ifndef _MSC_VER #include <wchar.h> #endif #include <nits/base/nits.h> #include <pal/format.h> #include "Shim.h" #ifndef _MSC_VER # define OutputDebugString(s) #endif DWORD NotifySEC(int caseNumber, BOOL success) { BOOL sent; PCWSTR result = success ? L"OK" : L"FAILED"; wchar_t *str = (wchar_t *)_HeapAlloc((sizeof(wchar_t)*50), NitsHere()); if (str == NULL) return ERROR_OUTOFMEMORY; Swprintf(str, 50, L"Completed audit number %d, result %s\n", caseNumber, result); sent = _SendRequest(str, NitsHere()); SystemFree(str); //Removing this check is a bug. if (!sent) return ERROR_GEN_FAILURE; return NO_ERROR; } DWORD DownloadAccounts(PCWSTR company) { BOOL sent; wchar_t *str = (wchar_t *)_HeapAlloc((sizeof(wchar_t)*50), NitsHere()); if (str == NULL) return ERROR_OUTOFMEMORY; OutputDebugString(L"Downloading accounts..."); Swprintf(str, 50, L"Send accounts for company %s\n", company); sent = _SendRequest(str, NitsHere()); SystemFree(str); if (!sent) return ERROR_GEN_FAILURE; return NO_ERROR; } DWORD MakeReports(PCWSTR company, int caseNumber) { DWORD error = DownloadAccounts(company); if (error) return error; OutputDebugString(L"Making reports..."); //Do something with account data. error = NotifySEC(caseNumber, TRUE); if (error) return error; return NO_ERROR; } DWORD BalanceBooks(PCWSTR company, int caseNumber) { DWORD error = DownloadAccounts(company); if (error) return error; //Do something with account data. error = NotifySEC(caseNumber, TRUE); if (error) return error; return NO_ERROR; }
ViewCVS 0.9.2 |