00001 /* 00002 * PROPRIETARY INFORMATION. This software is proprietary to 00003 * Side Effects Software Inc., and is not to be reproduced, 00004 * transmitted, or disclosed in any way without written permission. 00005 * 00006 * Produced by: 00007 * Chris Thompson 00008 * 00009 * NAME: Utility Library (C++) 00010 * 00011 * COMMENTS: 00012 * Functions for logging all files that Houdini opens, attempts 00013 * to open, or tests for existance. Can be extended to handle 00014 * any Windows SDK calls. 00015 * 00016 * This is useful for debugging--in particular, figuring out 00017 * why Houdini won't run or takes a long time to load on a 00018 * given system. 00019 */ 00020 00021 #ifndef __UT_NTSysTracer_H__ 00022 #define __UT_NTSysTracer_H__ 00023 00024 #include "UT_API.h" 00025 #include "UT_Defines.h" 00026 #include "UT_SysClone.h" 00027 #include <stdio.h> 00028 00029 00030 enum UT_SysTraceTargets { 00031 UT_SYSTRACE_NONE = 0, 00032 00033 UT_SYSTRACE_CREATEFILE = 1 << 0, 00034 UT_SYSTRACE_OPENFILE = 1 << 1, 00035 UT_SYSTRACE_FINDFIRSTFILE = 1 << 2, 00036 UT_SYSTRACE_FINDFIRSTFILEEX = 1 << 3, 00037 UT_SYSTRACE_GETDISKFREESPACE = 1 << 4, 00038 UT_SYSTRACE_GETDISKFREESPACEEX = 1 << 5, 00039 UT_SYSTRACE_GETFILEATTRIBUTES = 1 << 6, 00040 UT_SYSTRACE_GETFILEATTRIBUTESEX = 1 << 7, 00041 UT_SYSTRACE_GETFILESECURITY = 1 << 8, 00042 UT_SYSTRACE_GETVOLUMEINFORMATION = 1 << 9, 00043 00044 UT_SYSTRACE_ALL = 0xfffffff 00045 }; 00046 00047 00048 class UT_API UT_SysTracer 00049 { 00050 public: 00051 // Checks for the environment variable HOUDINI_SYSTRACE, and 00052 // if set, calls installSysTracer(). Output goes by default 00053 // to stdout (the Houdini console), but can be redirected to 00054 // a file by setting the environment variable HOUDINI_SYSTRACE_FILENAME. 00055 static UT_Bool initTracer( int targets ); 00056 00057 // This should only be called once (when Houdini terminates). 00058 // (It's registered as a UT_Exit callback, so you don't have to 00059 // call it explicitly.) 00060 static void terminateTracer(); 00061 00062 // Installs tracing functions for the specified system functions. 00063 // 00064 // 'targets' can be a combination of one or more of the flags 00065 // in UT_SysTraceTargets. 00066 // 00067 // Returns UT_TRUE on success, UT_FALSE otherwise. 00068 // 00069 // There is currently no way to uninstall these tracing functions, 00070 // however something along those lines would also be easy to 00071 // write (the code in UT_NTHooking.h already does this). 00072 static UT_Bool installSysTracer( int targets, FILE *toFile ); 00073 00074 private: 00075 static UT_Bool theTracerInitialized; 00076 }; 00077 00078 00079 #endif // __UT_NTSysTracer_H__
1.5.9