00001 // 00002 // UnWindows.h 00003 // 00004 // $Id: //poco/1.3/Foundation/include/Poco/UnWindows.h#2 $ 00005 // 00006 // Library: Foundation 00007 // Package: Core 00008 // Module: UnWindows 00009 // 00010 // A wrapper around the <windows.h> header file that #undef's some 00011 // of the macros for function names defined by <windows.h> that 00012 // are a frequent source of conflicts (e.g., GetUserName). 00013 // 00014 // Remember, that most of the WIN32 API functions come in two variants, 00015 // an Unicode variant (e.g., GetUserNameA) and an ASCII variant (GetUserNameW). 00016 // There is also a macro (GetUserName) that's either defined to be the Unicode 00017 // name or the ASCII name, depending on whether the UNICODE macro is #define'd 00018 // or not. POCO always calls the Unicode or ASCII functions directly (depending 00019 // on whether POCO_WIN32_UTF8 is #define'd or not), so the macros are not ignored. 00020 // 00021 // These macro definitions are a frequent case of problems and naming conflicts, 00022 // especially for C++ programmers. Say, you define a class with a member function named 00023 // GetUserName. Depending on whether "Poco/UnWindows.h" has been included by a particular 00024 // translation unit or not, this might be changed to GetUserNameA/GetUserNameW, or not. 00025 // While, due to naming conventions used, this is less of a problem in POCO, some 00026 // of the users of POCO might use a different naming convention where this can become 00027 // a problem. 00028 // 00029 // To disable the #undef's, compile POCO with the POCO_NO_UNWINDOWS macro #define'd. 00030 // 00031 // Copyright (c) 2007, Applied Informatics Software Engineering GmbH. 00032 // and Contributors. 00033 // 00034 // Permission is hereby granted, free of charge, to any person or organization 00035 // obtaining a copy of the software and accompanying documentation covered by 00036 // this license (the "Software") to use, reproduce, display, distribute, 00037 // execute, and transmit the Software, and to prepare derivative works of the 00038 // Software, and to permit third-parties to whom the Software is furnished to 00039 // do so, all subject to the following: 00040 // 00041 // The copyright notices in the Software and this entire statement, including 00042 // the above license grant, this restriction and the following disclaimer, 00043 // must be included in all copies of the Software, in whole or in part, and 00044 // all derivative works of the Software, unless such copies or derivative 00045 // works are solely in the form of machine-executable object code generated by 00046 // a source language processor. 00047 // 00048 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 00049 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 00050 // FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 00051 // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 00052 // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 00053 // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 00054 // DEALINGS IN THE SOFTWARE. 00055 // 00056 00057 00058 #include <windows.h> 00059 00060 00061 #if !defined(POCO_NO_UNWINDOWS) 00062 // A list of annoying macros to #undef. 00063 // Feel free to extend as required. 00064 #undef GetBinaryType 00065 #undef GetShortPathName 00066 #undef GetLongPathName 00067 #undef GetEnvironmentStrings 00068 #undef SetEnvironmentStrings 00069 #undef FreeEnvironmentStrings 00070 #undef FormatMessage 00071 #undef EncryptFile 00072 #undef DecryptFile 00073 #undef CreateMutex 00074 #undef OpenMutex 00075 #undef CreateEvent 00076 #undef OpenEvent 00077 #undef CreateSemaphore 00078 #undef OpenSemaphore 00079 #undef LoadLibrary 00080 #undef GetModuleFileName 00081 #undef CreateProcess 00082 #undef GetCommandLine 00083 #undef GetEnvironmentVariable 00084 #undef SetEnvironmentVariable 00085 #undef ExpandEnvironmentStrings 00086 #undef OutputDebugString 00087 #undef FindResource 00088 #undef UpdateResource 00089 #undef FindAtom 00090 #undef AddAtom 00091 #undef GetSystemDirector 00092 #undef GetTempPath 00093 #undef GetTempFileName 00094 #undef SetCurrentDirectory 00095 #undef GetCurrentDirectory 00096 #undef CreateDirectory 00097 #undef RemoveDirectory 00098 #undef CreateFile 00099 #undef DeleteFile 00100 #undef SearchPath 00101 #undef CopyFile 00102 #undef MoveFile 00103 #undef ReplaceFile 00104 #undef GetComputerName 00105 #undef SetComputerName 00106 #undef GetUserName 00107 #undef LogonUser 00108 #undef GetVersion 00109 #undef GetObject 00110 #endif // POCO_NO_UNWINDOWS