(file) Return to Product.c CVS log (file) (dir) Up to [OMI] / omi / nits / sample

 1 krisbash 1.1 //*****************************************************************************
 2              //	Copyright (C) 2011 Microsoft Corporation
 3              //  All rights reserved.
 4              //*****************************************************************************
 5              
 6              #ifndef HOOK_BUILD
 7              #define HOOK_BUILD
 8              #endif
 9              
10              #ifdef _MSC_VER
11              	#include <sal.h>
12              	#include <windows.h>
13              	#include <strsafe.h>
14              #endif
15              
16              #ifndef _MSC_VER
17              	#include <wchar.h>
18              #endif
19              
20              #include <nits/base/nits.h>
21              #include <pal/format.h>
22 krisbash 1.1 #include "Shim.h"
23              
24              #ifndef _MSC_VER
25              # define OutputDebugString(s)
26              #endif
27              
28              DWORD NotifySEC(int caseNumber, BOOL success)
29              {
30                  BOOL sent;
31                  PCWSTR result = success ? L"OK" : L"FAILED";
32                  wchar_t *str = (wchar_t *)_HeapAlloc((sizeof(wchar_t)*50), NitsHere());
33                  if (str == NULL)
34                      return ERROR_OUTOFMEMORY;
35              
36              	Swprintf(str, 50, L"Completed audit number %d, result %s\n", caseNumber, result);
37              
38                  sent = _SendRequest(str, NitsHere());
39                  SystemFree(str);
40              
41                  //Removing this check is a bug.
42                  if (!sent)
43 krisbash 1.1         return ERROR_GEN_FAILURE;
44              
45                  return NO_ERROR;
46              }
47              
48              DWORD DownloadAccounts(PCWSTR company)
49              {
50                  BOOL sent;
51                  wchar_t *str = (wchar_t *)_HeapAlloc((sizeof(wchar_t)*50), NitsHere());
52                  if (str == NULL)
53                      return ERROR_OUTOFMEMORY;
54              
55                  OutputDebugString(L"Downloading accounts...");
56              
57              	Swprintf(str, 50, L"Send accounts for company %s\n", company);
58                  sent = _SendRequest(str, NitsHere());
59                  SystemFree(str);
60              
61                  if (!sent)
62                      return ERROR_GEN_FAILURE;
63              
64 krisbash 1.1     return NO_ERROR;
65              }
66              
67              DWORD MakeReports(PCWSTR company, int caseNumber)
68              {
69                  DWORD error = DownloadAccounts(company);
70                  if (error) return error;
71              
72                  OutputDebugString(L"Making reports...");
73                  //Do something with account data.
74              
75                  error = NotifySEC(caseNumber, TRUE);
76                  if (error) return error;
77              
78                  return NO_ERROR;
79              }
80              
81              DWORD BalanceBooks(PCWSTR company, int caseNumber)
82              {
83                  DWORD error = DownloadAccounts(company);
84                  if (error) return error;
85 krisbash 1.1 
86                  //Do something with account data.
87              
88                  error = NotifySEC(caseNumber, TRUE);
89                  if (error) return error;
90              
91                  return NO_ERROR;
92              }
93              

ViewCVS 0.9.2