int total=0; bool AQLCreateDirectory(WCHAR * sPathTo) { while(CreateDirectory(sPathTo, NULL) == FALSE) { WCHAR sTemp[MAX_PATH]; int k = wcslen(sPathTo); wcscpy(sTemp, sPathTo); while(CreateDirectory(sTemp, NULL) != TRUE) { while(sTemp[--k] != L'\\') { if(k<=1) return FALSE; sTemp[k] = NULL; } } } return TRUE; }; void Process(IDiaSession *pSession, IDiaSymbol *pGlobal) { int total=0; IDiaEnumSymbols *pEnumSymbols; if (FAILED(pGlobal->findChildren(SymTagCompiland, NULL, nsNone, &pEnumSymbols))) return; IDiaSymbol *pCompiland; ULONG celt = 0; while (SUCCEEDED(pEnumSymbols->Next(1, &pCompiland, &celt)) && (celt == 1)) { pCompiland->Release(); total++; } fwprintf(pFileout,L"%i\n", total); pEnumSymbols->Release(); if (FAILED(pGlobal->findChildren(SymTagCompiland, NULL, nsNone, &pEnumSymbols))) return; celt = 0; while (SUCCEEDED(pEnumSymbols->Next(1, &pCompiland, &celt)) && (celt == 1)) { BSTR bstrName; if (pCompiland->get_name(&bstrName) == S_OK) { fwprintf(pFileout,L"%s\n", bstrName); SysFreeString(bstrName); } int num=0; IDiaEnumSourceFiles *pEnumSourceFiles; if (SUCCEEDED(pSession->findFile(pCompiland, NULL, nsNone, &pEnumSourceFiles))) { IDiaSourceFile *pSourceFile; while (SUCCEEDED(pEnumSourceFiles->Next(1, &pSourceFile, &celt)) && (celt == 1)) { num++; pSourceFile->Release(); } pEnumSourceFiles->Release(); fwprintf(pFileout,L"%i\n", num); } if (SUCCEEDED(pSession->findFile(pCompiland, NULL, nsNone, &pEnumSourceFiles))) { IDiaSourceFile *pSourceFile; while (SUCCEEDED(pEnumSourceFiles->Next(1, &pSourceFile, &celt)) && (celt == 1)) { BSTR bstrSourceName; if (pSourceFile->get_fileName(&bstrSourceName) == S_OK) { fwprintf(pFileout,L"%s\n", bstrSourceName); WCHAR *path = new WCHAR[wcslen(bstrSourceName)+8]; wcscpy(path,L"c:\\test\\"); wcscat(path,bstrSourceName+2); WCHAR *filename = new WCHAR[wcslen(path)+1]; wcscpy(filename,path); for(int k=wcslen(path)-1;k>=0&&path[k]!=L'\\';k--)path[k]=0; bool ok = AQLCreateDirectory(path); FILE *file = _wfopen(filename,L"w"); fclose(file); delete(filename); delete(path); SysFreeString(bstrSourceName); } pSourceFile->Release(); } pEnumSourceFiles->Release(); } pCompiland->Release(); } pEnumSymbols->Release(); }