ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

loadperf_main.c
Go to the documentation of this file.
00001 /*
00002  * Implementation of loadperf.dll
00003  *
00004  * Copyright 2009 Andrey Turkin
00005  *
00006  * This library is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU Lesser General Public
00008  * License as published by the Free Software Foundation; either
00009  * version 2.1 of the License, or (at your option) any later version.
00010  *
00011  * This library is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  * Lesser General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU Lesser General Public
00017  * License along with this library; if not, write to the Free Software
00018  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
00019  */
00020 
00021 #include "config.h"
00022 
00023 #include <stdarg.h>
00024 
00025 #include "windef.h"
00026 #include "winbase.h"
00027 #include "winerror.h"
00028 #include "winnls.h"
00029 #include "wine/debug.h"
00030 
00031 #include "loadperf.h"
00032 
00033 WINE_DEFAULT_DEBUG_CHANNEL(loadperf);
00034 
00035 BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
00036 {
00037     TRACE("(0x%p, %d, %p)\n",hinstDLL,fdwReason,lpvReserved);
00038 
00039     switch(fdwReason)
00040     {
00041     case DLL_WINE_PREATTACH:
00042         return FALSE; /* prefer native version */
00043     case DLL_PROCESS_ATTACH:
00044         DisableThreadLibraryCalls(hinstDLL);
00045         break;
00046     case DLL_PROCESS_DETACH:
00047         break;
00048     }
00049 
00050     return TRUE;
00051 }
00052 
00053 static WCHAR *strdupAW(const char *str)
00054 {
00055     WCHAR *ret = NULL;
00056     if (str)
00057     {
00058         INT len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
00059         if (!(ret = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)))) return NULL;
00060         MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
00061     }
00062     return ret;
00063 }
00064 
00065 /*************************************************************
00066  *     InstallPerfDllA (loadperf.@)
00067  */
00068 DWORD WINAPI InstallPerfDllA(LPCSTR computer, LPCSTR ini, ULONG_PTR flags)
00069 {
00070     DWORD ret;
00071     LPWSTR computerW = NULL, iniW = NULL;
00072 
00073     if (computer && !(computerW = strdupAW(computer))) return ERROR_OUTOFMEMORY;
00074     if (ini && !(iniW = strdupAW(ini)))
00075     {
00076         HeapFree(GetProcessHeap(), 0, computerW);
00077         return ERROR_OUTOFMEMORY;
00078     }
00079 
00080     ret = InstallPerfDllW(computerW, iniW, flags);
00081 
00082     HeapFree(GetProcessHeap(), 0, computerW);
00083     HeapFree(GetProcessHeap(), 0, iniW);
00084 
00085     return ret;
00086 }
00087 
00088 /*************************************************************
00089  *     InstallPerfDllW (loadperf.@)
00090  */
00091 DWORD WINAPI InstallPerfDllW(LPCWSTR computer, LPCWSTR ini, ULONG_PTR flags)
00092 {
00093     FIXME("(%s, %s, %lx)\n", debugstr_w(computer), debugstr_w(ini), flags);
00094     return ERROR_SUCCESS;
00095 }
00096 
00097 /*************************************************************
00098  *     LoadPerfCounterTextStringsA (loadperf.@)
00099  *
00100  * NOTES
00101  *   See LoadPerfCounterTextStringsW
00102  */
00103 DWORD WINAPI LoadPerfCounterTextStringsA(LPCSTR cmdline, BOOL quiet)
00104 {
00105     DWORD ret;
00106     LPWSTR cmdlineW = NULL;
00107 
00108     if (cmdline && !(cmdlineW = strdupAW(cmdline))) return ERROR_OUTOFMEMORY;
00109 
00110     ret = LoadPerfCounterTextStringsW(cmdlineW, quiet);
00111 
00112     HeapFree(GetProcessHeap(), 0, cmdlineW);
00113 
00114     return ret;
00115 }
00116 
00117 /*************************************************************
00118  *     LoadPerfCounterTextStringsW (loadperf.@)
00119  *
00120  * PARAMS
00121  *   cmdline [in] Last argument in command line - ini file to be used
00122  *   quiet   [in] FALSE - the function may write to stdout
00123  *
00124  */
00125 DWORD WINAPI LoadPerfCounterTextStringsW(LPCWSTR cmdline, BOOL quiet)
00126 {
00127     FIXME("(%s, %d): stub\n", debugstr_w(cmdline), quiet);
00128 
00129     return ERROR_SUCCESS;
00130 }
00131 
00132 /*************************************************************
00133  *     UnloadPerfCounterTextStringsA (loadperf.@)
00134  *
00135  * NOTES
00136  *   See UnloadPerfCounterTextStringsW
00137  */
00138 DWORD WINAPI UnloadPerfCounterTextStringsA(LPCSTR cmdline, BOOL quiet)
00139 {
00140     DWORD ret;
00141     LPWSTR cmdlineW = NULL;
00142 
00143     if (cmdline && !(cmdlineW = strdupAW(cmdline))) return ERROR_OUTOFMEMORY;
00144 
00145     ret = UnloadPerfCounterTextStringsW(cmdlineW, quiet);
00146 
00147     HeapFree(GetProcessHeap(), 0, cmdlineW);
00148 
00149     return ret;
00150 }
00151 
00152 /*************************************************************
00153  *     UnloadPerfCounterTextStringsW (loadperf.@)
00154  *
00155  * PARAMS
00156  *   cmdline [in] Last argument in command line - application counters to be removed
00157  *   quiet   [in] FALSE - the function may write to stdout
00158  *
00159  */
00160 DWORD WINAPI UnloadPerfCounterTextStringsW(LPCWSTR cmdline, BOOL quiet)
00161 {
00162     FIXME("(%s, %d): stub\n", debugstr_w(cmdline), quiet);
00163 
00164     return ERROR_SUCCESS;
00165 }

Generated on Sat May 26 2012 04:23:09 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.