![]() |
UltraDefrag Engine Architecture - Reference Manual - Guides |
|
00001 /* 00002 * UltraDefrag - powerful defragmentation tool for Windows NT. 00003 * Copyright (c) 2007-2010 by Dmitri Arkhangelski (dmitriar@gmail.com). 00004 * 00005 * This program is free software; you can redistribute it and/or modify 00006 * it under the terms of the GNU General Public License as published by 00007 * the Free Software Foundation; either version 2 of the License, or 00008 * (at your option) any later version. 00009 * 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU General Public License 00016 * along with this program; if not, write to the Free Software 00017 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00018 */ 00019 00027 #include "globals.h" 00028 00032 void InitializeOptions(void) 00033 { 00034 short *env_buffer; 00035 #define ENV_BUFFER_SIZE 8192 00036 00037 /* allocate memory */ 00038 env_buffer = winx_heap_alloc(ENV_BUFFER_SIZE * sizeof(short)); 00039 if(!env_buffer){ 00040 DebugPrint("Cannot allocate %u bytes for InitializeOptions()\n", 00041 ENV_BUFFER_SIZE * sizeof(short)); 00042 out_of_memory_condition_counter ++; 00043 return; 00044 } 00045 00046 /* reset options */ 00047 disable_reports = FALSE; 00048 dbgprint_level = DBG_NORMAL; 00049 00050 /* read program's options from environment variables */ 00051 if(winx_query_env_variable(L"UD_DISABLE_REPORTS",env_buffer,ENV_BUFFER_SIZE) >= 0) { 00052 if(!wcscmp(env_buffer,L"1")) disable_reports = TRUE; 00053 } 00054 if(winx_query_env_variable(L"UD_DBGPRINT_LEVEL",env_buffer,ENV_BUFFER_SIZE) >= 0){ 00055 (void)_wcsupr(env_buffer); 00056 if(!wcscmp(env_buffer,L"DETAILED")) 00057 dbgprint_level = DBG_DETAILED; 00058 else if(!wcscmp(env_buffer,L"PARANOID")) 00059 dbgprint_level = DBG_PARANOID; 00060 else if(!wcscmp(env_buffer,L"NORMAL")) 00061 dbgprint_level = DBG_NORMAL; 00062 } 00063 00064 /* initialize filter */ 00065 InitializeFilter(); 00066 00067 /* print options */ 00068 if(disable_reports) 00069 DebugPrint("Disable reports: YES\n"); 00070 else 00071 DebugPrint("Disable reports: NO\n"); 00072 DebugPrint("dbg_level=%u\n",dbgprint_level); 00073 00074 /* free memory */ 00075 winx_heap_free(env_buffer); 00076 } 00077