1
1

- 4/4 commit for Windows Visual Studio and CCP support:

unnecessary clean up to non windows related files (within ifdef __WINDOWS__).

This commit was SVN r20111.
Этот коммит содержится в:
Shiqing Fan 2008-12-10 21:13:27 +00:00
родитель 20cea164db
Коммит 5ae5f0e173
3 изменённых файлов: 68 добавлений и 98 удалений

Просмотреть файл

@ -93,7 +93,7 @@ static char * force_agg_path = NULL;
* local functions * local functions
*/ */
#if defined(__WINDOWS__) #if defined(__WINDOWS__)
static int read_keys_from_registry(HKEY hKey, char *sub_key, char *current_key); static int read_keys_from_registry(HKEY hKey, char *sub_key, char *current_name);
#endif /* defined(__WINDOWS__) */ #endif /* defined(__WINDOWS__) */
static int fixup_files(char **file_list, char * path, bool rel_path_search); static int fixup_files(char **file_list, char * path, bool rel_path_search);
static int read_files(char *file_list); static int read_files(char *file_list);
@ -1083,7 +1083,7 @@ static int read_files(char *file_list)
#define MAX_KEY_LENGTH 255 #define MAX_KEY_LENGTH 255
#define MAX_VALUE_NAME 16383 #define MAX_VALUE_NAME 16383
static int read_keys_from_registry(HKEY hKey, char *sub_key, char *current_key) static int read_keys_from_registry(HKEY hKey, char *sub_key, char *current_name)
{ {
TCHAR achKey[MAX_KEY_LENGTH]; /* buffer for subkey name */ TCHAR achKey[MAX_KEY_LENGTH]; /* buffer for subkey name */
DWORD cbName; /* size of name string */ DWORD cbName; /* size of name string */
@ -1100,8 +1100,8 @@ static int read_keys_from_registry(HKEY hKey, char *sub_key, char *current_key)
LPDWORD lpType; LPDWORD lpType;
LPDWORD word_lpData; LPDWORD word_lpData;
TCHAR str_lpData[MAX_VALUE_NAME]; TCHAR str_lpData[MAX_VALUE_NAME];
TCHAR *str_key_name, *tmp_key, *type; TCHAR *str_key_name, *type_name, *next_name;
DWORD dwSize, i, retCode, type_len; DWORD dwSize, i, retCode, type_len, param_type;
TCHAR achValue[MAX_VALUE_NAME]; TCHAR achValue[MAX_VALUE_NAME];
DWORD cchValue = MAX_VALUE_NAME; DWORD cchValue = MAX_VALUE_NAME;
HKEY hTestKey; HKEY hTestKey;
@ -1126,102 +1126,75 @@ static int read_keys_from_registry(HKEY hKey, char *sub_key, char *current_key)
NULL ); NULL );
/* Enumerate the subkeys, until RegEnumKeyEx fails. */ /* Enumerate the subkeys, until RegEnumKeyEx fails. */
if (cSubKeys) { for (i = 0; i < cSubKeys; i++) {
for (i = 0; i < cSubKeys; i++) { cbName = MAX_KEY_LENGTH;
cbName = MAX_KEY_LENGTH; retCode = RegEnumKeyEx(hTestKey, i, achKey, &cbName, NULL, NULL, NULL, NULL);
retCode = RegEnumKeyEx(hTestKey, i, achKey, &cbName, NULL, NULL, NULL, NULL); if (retCode != ERROR_SUCCESS) continue;
if (retCode == ERROR_SUCCESS) { asprintf(&sub_sub_key, "%s\\%s", sub_key, achKey);
asprintf(&sub_sub_key, "%s\\%s", sub_key, achKey); if( NULL != current_name ) {
if (current_key!=NULL) { asprintf(&next_name, "%s_%s", current_name, achKey);
asprintf(&tmp_key, "%s", current_key); } else {
asprintf(&current_key, "%s_%s", current_key, achKey); asprintf(&next_name, "%s", achKey);
} else {
tmp_key = NULL;
asprintf(&current_key, "%s", achKey);
}
read_keys_from_registry(hKey, sub_sub_key, current_key);
free(current_key);
if (tmp_key!=NULL) {
asprintf(&current_key, "%s", tmp_key);
free(tmp_key);
} else
current_key = NULL;
}
} }
} read_keys_from_registry(hKey, sub_sub_key, next_name);
free(next_name);
free(sub_sub_key);
}
/* Enumerate the key values. */ /* Enumerate the key values. */
if (cValues) { for( i = 0; i < cValues; i++ ) {
for (i=0, retCode=ERROR_SUCCESS; i<cValues; i++) { cchValue = MAX_VALUE_NAME;
cchValue = MAX_VALUE_NAME; achValue[0] = '\0';
achValue[0] = '\0'; retCode = RegEnumValue(hTestKey, i, achValue, &cchValue, NULL, NULL, NULL, NULL);
retCode = RegEnumValue(hTestKey, i, achValue, &cchValue, NULL, NULL, NULL, NULL); if (retCode != ERROR_SUCCESS ) continue;
if (retCode == ERROR_SUCCESS ) { /* lpType - get the type of the value
* dwSize - get the size of the buffer to hold the value
/* lpType - get the type of the value */
* dwSize - get the size of the buffer to hold the value retCode = RegQueryValueEx(hTestKey, achValue, NULL, (LPDWORD)&lpType, NULL, &dwSize);
*/
retCode = RegQueryValueEx(hTestKey, achValue, NULL, (LPDWORD)&lpType, NULL, &dwSize);
if (strcmp(achValue,"")) { if (strcmp(achValue,"")) {
if (current_key!=NULL) if (current_name!=NULL)
asprintf(&str_key_name, "%s_%s", current_key, achValue); asprintf(&type_name, "%s_%s", current_name, achValue);
else else
asprintf(&str_key_name, "%s", achValue); asprintf(&type_name, "%s", achValue);
} else { } else {
if (current_key!=NULL) if (current_name!=NULL)
asprintf(&str_key_name, "%s", current_key); asprintf(&type_name, "%s", current_name);
else else
asprintf(&str_key_name, "%s", achValue); asprintf(&type_name, "%s", achValue);
} }
type_len = strcspn(str_key_name, "_"); type_len = strcspn(type_name, "_");
type = (char*) malloc((type_len+1)*sizeof(char)); str_key_name = type_name + type_len + 1;
strncpy( type, str_key_name, type_len ); if( type_len == strlen(type_name) )
if ( type_len == strlen(str_key_name) ) str_key_name = NULL;
strcpy( str_key_name, "" ); type_name[type_len] = '\0';
else
strcpy( str_key_name, str_key_name + type_len + 1 ); /* trim str_key_name by length of type + 1 for underscrore */ retCode = 1;
type[type_len]='\0'; if( lpType == (LPDWORD)REG_SZ ) { /* REG_SZ = 1 */
if (lpType == (LPDWORD) REG_SZ) { /* REG_SZ = 1 */ retCode = RegQueryValueEx(hTestKey, achValue, NULL, NULL, (LPBYTE)&str_lpData, &dwSize);
retCode = RegQueryValueEx(hTestKey, achValue, NULL, NULL, (LPBYTE)&str_lpData, &dwSize); storage.stringval = (char*)str_lpData;
if (!retCode) { override.stringval = (char*)str_lpData;
mca_base_param_storage_t storage, override; param_type = MCA_BASE_PARAM_TYPE_STRING;
mca_base_param_storage_t lookup; } else if( lpType == (LPDWORD)REG_DWORD ) { /* REG_DWORD = 4 */
retCode = RegQueryValueEx(hTestKey, achValue, NULL, NULL, (LPBYTE)&word_lpData, &dwSize);
storage.stringval = (char*)str_lpData; storage.intval = (int)word_lpData;
override.stringval = (char*)str_lpData; override.intval = (int)word_lpData;
(void)param_register( type, NULL, str_key_name, "Key read from Windows registry", param_type = MCA_BASE_PARAM_TYPE_INT;
MCA_BASE_PARAM_TYPE_STRING, false, false,
&storage, NULL, &override,
&lookup );
/*printf( "%s %s = %s.\n", type, str_key_name, str_lpData);*/
} else {
opal_output( 0, "error reading value of param_name: %s with %d error.\n",
str_key_name, retCode);
}
}
if (lpType == (LPDWORD) REG_DWORD) { /* REG_DWORD = 4 */
retCode = RegQueryValueEx(hTestKey, achValue, NULL, NULL, (LPBYTE)&word_lpData, &dwSize);
if (!retCode) {
storage.intval = (int)word_lpData;
override.intval = (int)word_lpData;
(void)param_register( type, NULL, str_key_name, "Key read from Windows registry",
MCA_BASE_PARAM_TYPE_INT, false, false,
&storage, NULL, &override,
&lookup );
/*printf( "%s %s = %d.\n", type, str_key_name, (int)word_lpData);*/
} else {
opal_output( 0, "error reading value of param_name: %s with %d error.\n",
str_key_name, retCode );
}
}
free(type);
free(str_key_name);
}
} }
if( !retCode ) {
(void)param_register( type_name, NULL, str_key_name, NULL,
param_type, false, false,
&storage, NULL, &override, &lookup );
} else {
opal_output( 0, "error reading value of param_name: %s with %d error.\n",
str_key_name, retCode);
}
free(type_name);
} }
RegCloseKey( hKey ); RegCloseKey( hKey );
return OPAL_SUCCESS; return OPAL_SUCCESS;

Просмотреть файл

@ -321,8 +321,7 @@ int opal_cr_init(void )
#endif #endif
#else #else
opal_output( 0, "This feature is disabled on Windows" ); opal_cr_is_tool = true; /* no support for CR on Windows yet */
return 0;
#endif /* __WINDOWS__ */ #endif /* __WINDOWS__ */
mca_base_param_reg_string_name("opal_cr", "tmp_dir", mca_base_param_reg_string_name("opal_cr", "tmp_dir",

Просмотреть файл

@ -645,9 +645,7 @@ int orte_plm_process_launch(orte_job_t *jdata)
if (NULL != param) free(param); if (NULL != param) free(param);
} }
{ {
char* name_string;
char** env; char** env;
char* var;
OPAL_OUTPUT_VERBOSE((1, orte_plm_globals.output, OPAL_OUTPUT_VERBOSE((1, orte_plm_globals.output,
"%s plm:process: launching on node %s", "%s plm:process: launching on node %s",