Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

697 lines
19 KiB

  1. //+--------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1994 - 1997.
  5. //
  6. // File: RSOPQuery.h
  7. //
  8. // Contents: Definitions for the RSOP query API
  9. //
  10. // Functions:
  11. // CreateRSOPQuery
  12. // RunRSOPQuery
  13. // FreeRSOPQuery
  14. // FreeRSOPQueryResults
  15. //
  16. // History: 07-30-2001 rhynierm Created
  17. //
  18. //---------------------------------------------------------------------------
  19. #include "main.h"
  20. #include "RSOPQuery.h"
  21. #include "RSOPWizard.h"
  22. #include "RSOPWizardDlg.h"
  23. //-------------------------------------------------------
  24. BOOL CopyString( LPTSTR szSource, LPTSTR* pszTarget )
  25. {
  26. if ( szSource == NULL )
  27. {
  28. (*pszTarget) = NULL;
  29. return TRUE;
  30. }
  31. ULONG ulNoChars = _tcslen(szSource)+1;
  32. *pszTarget = (LPTSTR)LocalAlloc( LPTR, sizeof(TCHAR) * ulNoChars );
  33. if ( *pszTarget == NULL )
  34. {
  35. return FALSE;
  36. }
  37. HRESULT hr;
  38. hr = StringCchCopy( *pszTarget, ulNoChars, szSource );
  39. ASSERT(SUCCEEDED(hr));
  40. return TRUE;
  41. }
  42. //-------------------------------------------------------
  43. BOOL CreateRSOPQuery( LPRSOP_QUERY* ppQuery, RSOP_QUERY_TYPE QueryType )
  44. {
  45. *ppQuery = (LPRSOP_QUERY)LocalAlloc( LPTR, sizeof(RSOP_QUERY) );
  46. if ( *ppQuery == NULL )
  47. {
  48. DWORD dwLastError = GetLastError();
  49. DebugMsg( (DM_WARNING, TEXT("CreateRSOPQuery: Failed to allocate memory with 0x%x."), HRESULT_FROM_WIN32(dwLastError)) );
  50. SetLastError( dwLastError );
  51. return FALSE;
  52. }
  53. (*ppQuery)->QueryType = QueryType;
  54. (*ppQuery)->UIMode = RSOP_UI_WIZARD;
  55. (*ppQuery)->dwFlags = 0;
  56. if ( (QueryType == RSOP_UNKNOWN_MODE) || (QueryType == RSOP_LOGGING_MODE) )
  57. {
  58. (*ppQuery)->szUserName = NULL;
  59. (*ppQuery)->szUserSid = NULL;
  60. (*ppQuery)->szComputerName = NULL;
  61. }
  62. else // QueryType == RSOP_PLANNING_MODE
  63. {
  64. (*ppQuery)->bSlowNetworkConnection = FALSE;
  65. (*ppQuery)->LoopbackMode = RSOP_LOOPBACK_NONE;
  66. (*ppQuery)->szSite = NULL;
  67. (*ppQuery)->szDomainController = NULL;
  68. (*ppQuery)->pUser = (LPRSOP_QUERY_TARGET)LocalAlloc( LPTR, sizeof(RSOP_QUERY_TARGET) );
  69. (*ppQuery)->pComputer = (LPRSOP_QUERY_TARGET)LocalAlloc( LPTR, sizeof(RSOP_QUERY_TARGET) );
  70. if ( ((*ppQuery)->pUser == NULL) || ((*ppQuery)->pComputer == NULL) )
  71. {
  72. DWORD dwLastError = GetLastError();
  73. DebugMsg((DM_WARNING, TEXT("CreateRSOPQuery: Falied to allocate memory with 0x%x"),
  74. HRESULT_FROM_WIN32( dwLastError ) ));
  75. LocalFree( (*ppQuery)->pUser );
  76. LocalFree( (*ppQuery)->pComputer );
  77. LocalFree( *ppQuery );
  78. *ppQuery = NULL;
  79. SetLastError( dwLastError );
  80. return FALSE;
  81. }
  82. (*ppQuery)->pUser->bAssumeWQLFiltersTrue = TRUE;
  83. (*ppQuery)->pComputer->bAssumeWQLFiltersTrue = TRUE;
  84. }
  85. return TRUE;
  86. }
  87. //-------------------------------------------------------
  88. BOOL FreeStringList( DWORD dwCount, LPTSTR* aszStrings )
  89. {
  90. if ( aszStrings == NULL )
  91. {
  92. return TRUE;
  93. }
  94. for ( DWORD dw = 0; dw < dwCount; dw++ )
  95. {
  96. LocalFree( aszStrings[dw] );
  97. aszStrings[dw] = NULL;
  98. }
  99. LocalFree( aszStrings );
  100. return TRUE;
  101. }
  102. //-------------------------------------------------------
  103. BOOL CopyStringList( DWORD dwCount, LPTSTR* aszStrings , DWORD* pdwNewCount, LPTSTR** paszNewStrings )
  104. {
  105. DWORD dw = 0;
  106. *pdwNewCount = 0;
  107. if ( (aszStrings == NULL) || (dwCount == 0) )
  108. {
  109. *paszNewStrings = NULL;
  110. return TRUE;
  111. }
  112. *paszNewStrings = (LPTSTR*)LocalAlloc( LPTR, sizeof(LPTSTR) * dwCount );
  113. if ( *paszNewStrings == NULL )
  114. {
  115. return FALSE;
  116. }
  117. for ( dw = 0; dw < dwCount; dw++ )
  118. {
  119. if ( !CopyString( aszStrings[dw], &((*paszNewStrings)[dw]) ) )
  120. {
  121. goto ErrorExit;
  122. }
  123. }
  124. *pdwNewCount = dwCount;
  125. return TRUE;
  126. ErrorExit:
  127. if ( dw > 0 )
  128. {
  129. if ( FreeStringList( dw-1, *paszNewStrings ) )
  130. {
  131. *paszNewStrings = NULL;
  132. }
  133. }
  134. else
  135. {
  136. LocalFree( *paszNewStrings );
  137. *paszNewStrings = NULL;
  138. }
  139. return FALSE;
  140. }
  141. //-------------------------------------------------------
  142. BOOL FreeTargetData( LPRSOP_QUERY_TARGET pTarget )
  143. {
  144. if ( pTarget == NULL )
  145. {
  146. return TRUE;
  147. }
  148. LocalFree( pTarget->szName );
  149. pTarget->szName = NULL;
  150. LocalFree( pTarget->szSOM );
  151. pTarget->szSOM = NULL;
  152. bool bSuccess = TRUE;
  153. if ( FreeStringList( pTarget->dwSecurityGroupCount, pTarget->aszSecurityGroups ) )
  154. {
  155. pTarget->aszSecurityGroups = NULL;
  156. pTarget->dwSecurityGroupCount = 0;
  157. }
  158. else
  159. {
  160. bSuccess = FALSE;
  161. }
  162. if ( pTarget->adwSecurityGroupsAttr != NULL )
  163. {
  164. LocalFree( pTarget->adwSecurityGroupsAttr );
  165. pTarget->adwSecurityGroupsAttr = NULL;
  166. }
  167. DWORD dwCount = pTarget->dwWQLFilterCount;
  168. if ( FreeStringList( pTarget->dwWQLFilterCount, pTarget->aszWQLFilters) )
  169. {
  170. pTarget->aszWQLFilters = NULL;
  171. pTarget->dwWQLFilterCount = 0;
  172. }
  173. else
  174. {
  175. bSuccess = FALSE;
  176. }
  177. if ( FreeStringList( dwCount, pTarget->aszWQLFilterNames) )
  178. {
  179. pTarget->aszWQLFilterNames = NULL;
  180. }
  181. else
  182. {
  183. bSuccess = FALSE;
  184. }
  185. return bSuccess;
  186. }
  187. //-------------------------------------------------------
  188. BOOL FreeTarget( LPRSOP_QUERY_TARGET pTarget )
  189. {
  190. if ( pTarget == NULL )
  191. {
  192. return TRUE;
  193. }
  194. if ( FreeTargetData( pTarget ) )
  195. {
  196. LocalFree( pTarget );
  197. return TRUE;
  198. }
  199. return FALSE;
  200. }
  201. //-------------------------------------------------------
  202. BOOL CopyTarget( LPRSOP_QUERY_TARGET pTarget, LPRSOP_QUERY_TARGET* ppNewTarget )
  203. {
  204. if ( pTarget == NULL )
  205. {
  206. *ppNewTarget = NULL;
  207. return TRUE;
  208. }
  209. *ppNewTarget = (LPRSOP_QUERY_TARGET)LocalAlloc( LPTR, sizeof(RSOP_QUERY_TARGET) );
  210. if ( *ppNewTarget == NULL )
  211. {
  212. return FALSE;
  213. }
  214. ZeroMemory( *ppNewTarget, sizeof(RSOP_QUERY_TARGET) );
  215. if ( !CopyString( pTarget->szName, &((*ppNewTarget)->szName) ) )
  216. {
  217. goto ErrorExit;
  218. }
  219. if ( !CopyString( pTarget->szSOM, &((*ppNewTarget)->szSOM) ) )
  220. {
  221. goto ErrorExit;
  222. }
  223. if ( !CopyStringList( pTarget->dwSecurityGroupCount, pTarget->aszSecurityGroups,
  224. &((*ppNewTarget)->dwSecurityGroupCount), &((*ppNewTarget)->aszSecurityGroups) ) )
  225. {
  226. goto ErrorExit;
  227. }
  228. if ( !CopyStringList( pTarget->dwWQLFilterCount, pTarget->aszWQLFilterNames,
  229. &((*ppNewTarget)->dwWQLFilterCount), &((*ppNewTarget)->aszWQLFilterNames) ) )
  230. {
  231. goto ErrorExit;
  232. }
  233. if ( !CopyStringList( pTarget->dwWQLFilterCount, pTarget->aszWQLFilters,
  234. &((*ppNewTarget)->dwWQLFilterCount), &((*ppNewTarget)->aszWQLFilters) ) )
  235. {
  236. goto ErrorExit;
  237. }
  238. if ( pTarget->adwSecurityGroupsAttr != NULL )
  239. {
  240. (*ppNewTarget)->adwSecurityGroupsAttr = (DWORD*)LocalAlloc( LPTR, sizeof(DWORD)*pTarget->dwSecurityGroupCount );
  241. if ( (*ppNewTarget)->adwSecurityGroupsAttr == NULL )
  242. {
  243. goto ErrorExit;
  244. }
  245. memcpy( (*ppNewTarget)->adwSecurityGroupsAttr, pTarget->adwSecurityGroupsAttr, sizeof(DWORD)*pTarget->dwSecurityGroupCount );
  246. }
  247. (*ppNewTarget)->bAssumeWQLFiltersTrue = pTarget->bAssumeWQLFiltersTrue;
  248. return TRUE;
  249. ErrorExit:
  250. FreeTarget( *ppNewTarget );
  251. *ppNewTarget = NULL;
  252. return FALSE;
  253. }
  254. //-------------------------------------------------------
  255. BOOL FreeRSOPQueryData( LPRSOP_QUERY pQuery )
  256. {
  257. BOOL bSuccess = TRUE;
  258. if ( pQuery == NULL )
  259. {
  260. return TRUE;
  261. }
  262. if ( pQuery->QueryType == RSOP_PLANNING_MODE )
  263. {
  264. if ( FreeTarget( pQuery->pUser ) )
  265. {
  266. pQuery->pUser = NULL;
  267. }
  268. else
  269. {
  270. bSuccess = FALSE;
  271. }
  272. if ( FreeTarget( pQuery->pComputer ) )
  273. {
  274. pQuery->pUser = NULL;
  275. }
  276. else
  277. {
  278. bSuccess = FALSE;
  279. }
  280. LocalFree( pQuery->szSite );
  281. pQuery->szSite = NULL;
  282. LocalFree( pQuery->szDomainController );
  283. pQuery->szDomainController = NULL;
  284. }
  285. else
  286. {
  287. LocalFree( pQuery->szUserName );
  288. pQuery->szUserName = NULL;
  289. LocalFree( pQuery->szUserSid );
  290. pQuery->szUserSid = NULL;
  291. LocalFree( pQuery->szComputerName );
  292. pQuery->szComputerName = NULL;
  293. }
  294. return bSuccess;
  295. }
  296. //-------------------------------------------------------
  297. BOOL FreeRSOPQuery( LPRSOP_QUERY pQuery )
  298. {
  299. if ( pQuery == NULL )
  300. {
  301. return TRUE;
  302. }
  303. if ( !FreeRSOPQueryData( pQuery ) )
  304. {
  305. return FALSE;
  306. }
  307. LocalFree( pQuery );
  308. return TRUE;
  309. }
  310. //-------------------------------------------------------
  311. BOOL CopyRSOPQuery( LPRSOP_QUERY pQuery, LPRSOP_QUERY* ppNewQuery )
  312. {
  313. if ( pQuery == NULL )
  314. {
  315. *ppNewQuery = NULL;
  316. return TRUE;
  317. }
  318. *ppNewQuery = (LPRSOP_QUERY)LocalAlloc( LPTR, sizeof(RSOP_QUERY) );
  319. if ( *ppNewQuery == NULL )
  320. {
  321. return FALSE;
  322. }
  323. (*ppNewQuery)->QueryType = pQuery->QueryType;
  324. (*ppNewQuery)->UIMode = pQuery->UIMode;
  325. (*ppNewQuery)->dwFlags = pQuery->dwFlags;
  326. if ( pQuery->QueryType == RSOP_PLANNING_MODE )
  327. {
  328. (*ppNewQuery)->bSlowNetworkConnection = pQuery->bSlowNetworkConnection;
  329. (*ppNewQuery)->LoopbackMode = pQuery->LoopbackMode;
  330. if ( !CopyTarget( pQuery->pUser, &((*ppNewQuery)->pUser) ) )
  331. {
  332. goto ErrorExit;
  333. }
  334. if ( !CopyTarget( pQuery->pComputer, &((*ppNewQuery)->pComputer) ) )
  335. {
  336. goto ErrorExit;
  337. }
  338. if ( !CopyString( pQuery->szSite, &((*ppNewQuery)->szSite) ) )
  339. {
  340. goto ErrorExit;
  341. }
  342. if ( !CopyString( pQuery->szDomainController, &((*ppNewQuery)->szDomainController) ) )
  343. {
  344. goto ErrorExit;
  345. }
  346. }
  347. else
  348. {
  349. if ( !CopyString( pQuery->szComputerName, &((*ppNewQuery)->szComputerName) ) )
  350. {
  351. goto ErrorExit;
  352. }
  353. if ( !CopyString( pQuery->szUserName, &((*ppNewQuery)->szUserName) ) )
  354. {
  355. goto ErrorExit;
  356. }
  357. if ( !CopyString( pQuery->szUserSid, &((*ppNewQuery)->szUserSid) ) )
  358. {
  359. goto ErrorExit;
  360. }
  361. }
  362. return TRUE;
  363. ErrorExit:
  364. if ( FreeRSOPQuery( *ppNewQuery ) )
  365. {
  366. *ppNewQuery = NULL;
  367. }
  368. return FALSE;
  369. }
  370. //-------------------------------------------------------
  371. BOOL ChangeRSOPQueryType( LPRSOP_QUERY pQuery, RSOP_QUERY_TYPE NewQueryType )
  372. {
  373. if ( pQuery->QueryType != NewQueryType )
  374. {
  375. if ( pQuery->QueryType == RSOP_PLANNING_MODE )
  376. {
  377. FreeTarget( pQuery->pUser );
  378. pQuery->pUser = NULL;
  379. FreeTarget( pQuery->pComputer );
  380. pQuery->pComputer = NULL;
  381. LocalFree( pQuery->szSite );
  382. pQuery->szSite = NULL;
  383. LocalFree( pQuery->szDomainController );
  384. pQuery->szDomainController = NULL;
  385. }
  386. else
  387. {
  388. LocalFree( pQuery->szUserName );
  389. pQuery->szUserName = NULL;
  390. LocalFree( pQuery->szUserSid );
  391. pQuery->szUserSid = NULL;
  392. LocalFree( pQuery->szComputerName );
  393. pQuery->szComputerName = NULL;
  394. }
  395. pQuery->QueryType = NewQueryType;
  396. if ( pQuery->QueryType == RSOP_PLANNING_MODE )
  397. {
  398. pQuery->bSlowNetworkConnection = FALSE;
  399. pQuery->LoopbackMode = RSOP_LOOPBACK_NONE;
  400. pQuery->szSite = NULL;
  401. pQuery->szDomainController = NULL;
  402. pQuery->pUser = (LPRSOP_QUERY_TARGET)LocalAlloc( LPTR, sizeof(RSOP_QUERY_TARGET) );
  403. pQuery->pComputer = (LPRSOP_QUERY_TARGET)LocalAlloc( LPTR, sizeof(RSOP_QUERY_TARGET) );
  404. if ( (pQuery->pUser == NULL) || (pQuery->pComputer == NULL) )
  405. {
  406. DebugMsg((DM_WARNING, TEXT("ChangeRSOPQueryType: Falied to allocate memory with 0x%x"),
  407. HRESULT_FROM_WIN32( GetLastError() ) ));
  408. pQuery->QueryType = RSOP_LOGGING_MODE;
  409. LocalFree( pQuery->pUser );
  410. LocalFree( pQuery->pComputer );
  411. pQuery->szUserName = NULL;
  412. pQuery->szUserSid = NULL;
  413. pQuery->szComputerName = NULL;
  414. return FALSE;
  415. }
  416. pQuery->pUser->bAssumeWQLFiltersTrue = TRUE;
  417. pQuery->pComputer->bAssumeWQLFiltersTrue = TRUE;
  418. }
  419. else
  420. {
  421. pQuery->szUserName = NULL;
  422. pQuery->szUserSid = NULL;
  423. pQuery->szComputerName = NULL;
  424. }
  425. pQuery->dwFlags = pQuery->dwFlags & (RSOP_NO_USER_POLICY ^ 0xffffffff);
  426. pQuery->dwFlags = pQuery->dwFlags & (RSOP_NO_COMPUTER_POLICY ^ 0xffffffff);
  427. pQuery->dwFlags = pQuery->dwFlags & (RSOP_FIX_USER ^ 0xffffffff);
  428. pQuery->dwFlags = pQuery->dwFlags & (RSOP_FIX_COMPUTER ^ 0xffffffff);
  429. pQuery->dwFlags = pQuery->dwFlags & (RSOP_FIX_DC ^ 0xffffffff);
  430. pQuery->dwFlags = pQuery->dwFlags & (RSOP_FIX_SITENAME ^ 0xffffffff);
  431. }
  432. return TRUE;
  433. }
  434. //-------------------------------------------------------
  435. BOOL FreeRSOPQueryResults( LPRSOP_QUERY pQuery, LPRSOP_QUERY_RESULTS pResults )
  436. {
  437. if ( pResults == NULL )
  438. {
  439. return TRUE;
  440. }
  441. BOOL bSuccess = TRUE;
  442. if ( pResults->szWMINameSpace != NULL )
  443. {
  444. HRESULT hr = CRSOPWizard::DeleteRSOPData( pResults->szWMINameSpace, pQuery );
  445. if ( FAILED(hr) )
  446. {
  447. DebugMsg( (DM_WARNING, TEXT("FreeRSOPQueryResults: Failed to delete RSOP data with 0x%x."), hr) );
  448. bSuccess = FALSE;
  449. }
  450. else
  451. {
  452. LocalFree( pResults->szWMINameSpace );
  453. pResults->szWMINameSpace = NULL;
  454. }
  455. }
  456. if ( bSuccess )
  457. {
  458. LocalFree( pResults );
  459. }
  460. return bSuccess;
  461. }
  462. //-------------------------------------------------------
  463. HRESULT RunRSOPQueryInternal( HWND hParent, CRSOPExtendedProcessing* pExtendedProcessing,
  464. LPRSOP_QUERY pQuery, LPRSOP_QUERY_RESULTS* ppResults )
  465. {
  466. // Check parameters
  467. if ( pQuery == NULL )
  468. {
  469. return E_INVALIDARG;
  470. }
  471. if ( pQuery->QueryType == RSOP_UNKNOWN_MODE )
  472. {
  473. if ( (pQuery->UIMode == RSOP_UI_NONE)
  474. || ((pQuery->dwFlags & RSOP_FIX_QUERYTYPE) == RSOP_FIX_QUERYTYPE) )
  475. {
  476. return E_INVALIDARG;
  477. }
  478. }
  479. RSOP_UI_MODE UIMode = pQuery->UIMode;
  480. // Check if only the query needs to be run
  481. if ( (UIMode == RSOP_UI_CHOOSE) || (UIMode == RSOP_UI_REFRESH) || (UIMode == RSOP_UI_NONE) )
  482. {
  483. BOOL bRefreshOnly = TRUE;
  484. if ( pQuery->QueryType == RSOP_PLANNING_MODE )
  485. {
  486. if ( (pQuery->pUser->szName == NULL) && (pQuery->pUser->szSOM == NULL)
  487. && (pQuery->pComputer->szName == NULL) && (pQuery->pComputer->szSOM == NULL) )
  488. {
  489. bRefreshOnly = FALSE;
  490. }
  491. if ( pQuery->szDomainController == NULL )
  492. {
  493. bRefreshOnly = FALSE;
  494. }
  495. }
  496. else
  497. {
  498. if ( pQuery->szComputerName == NULL )
  499. {
  500. bRefreshOnly = FALSE;
  501. }
  502. else if ( (pQuery->szUserName == NULL) && (pQuery->szUserSid == NULL)
  503. && ((pQuery->dwFlags & RSOP_NO_COMPUTER_POLICY) == RSOP_NO_COMPUTER_POLICY) )
  504. {
  505. bRefreshOnly = FALSE;
  506. }
  507. }
  508. if ( UIMode == RSOP_UI_CHOOSE )
  509. {
  510. if ( bRefreshOnly )
  511. {
  512. UIMode = RSOP_UI_REFRESH;
  513. }
  514. else
  515. {
  516. UIMode = RSOP_UI_WIZARD;
  517. }
  518. }
  519. else // (UIMode == RSOP_REFRESH) || (UIMode == RSOP_NONE)
  520. {
  521. if ( !bRefreshOnly )
  522. {
  523. // We have to quit as the user requested refresh with insufficient information
  524. return E_INVALIDARG;
  525. }
  526. }
  527. }
  528. if ( UIMode == RSOP_UI_NONE )
  529. {
  530. *ppResults = (LPRSOP_QUERY_RESULTS)LocalAlloc( LPTR, sizeof(RSOP_QUERY_RESULTS) );
  531. if ( *ppResults == NULL )
  532. {
  533. DebugMsg( (DM_WARNING, TEXT("CreateRSOPQuery: Failed to allocate memory with 0x%x."), HRESULT_FROM_WIN32(GetLastError())) );
  534. return E_FAIL;
  535. }
  536. (*ppResults)->szWMINameSpace = 0;
  537. (*ppResults)->bUserDeniedAccess = FALSE;
  538. (*ppResults)->bNoUserPolicyData = FALSE;
  539. (*ppResults)->bComputerDeniedAccess = FALSE;
  540. (*ppResults)->bNoComputerPolicyData = FALSE;
  541. (*ppResults)->ulErrorInfo = 0;
  542. // Perform basic RSOP query
  543. return CRSOPWizard::GenerateRSOPData( NULL, pQuery, &((*ppResults)->szWMINameSpace),
  544. FALSE, FALSE, FALSE, FALSE, &((*ppResults)->ulErrorInfo) );
  545. }
  546. else
  547. {
  548. // Local variables
  549. CRSOPWizardDlg wizardDlg( pQuery, pExtendedProcessing );
  550. HRESULT hr = S_OK;
  551. LPRSOP_QUERY pOldQuery = NULL;
  552. if ( UIMode == RSOP_UI_REFRESH )
  553. {
  554. hr = wizardDlg.RunQuery( hParent );
  555. }
  556. else // UIMode == RSOP_UI_WIZARD
  557. {
  558. if ( !CopyRSOPQuery( pQuery, &pOldQuery ) )
  559. {
  560. hr = E_OUTOFMEMORY;
  561. }
  562. else
  563. {
  564. hr = wizardDlg.ShowWizard( hParent );
  565. }
  566. }
  567. // If successfull, replace original query and get results
  568. if ( hr == S_OK )
  569. {
  570. // Get the results
  571. *ppResults = wizardDlg.GetResults();
  572. // Wipe the old query
  573. FreeRSOPQuery( pOldQuery );
  574. }
  575. else if ( hr == S_FALSE )
  576. {
  577. // Copy back the old query
  578. if ( FreeRSOPQueryData( pQuery ) )
  579. {
  580. memcpy( pQuery, pOldQuery, sizeof(RSOP_QUERY) );
  581. LocalFree( pOldQuery );
  582. }
  583. else
  584. {
  585. FreeRSOPQuery( pOldQuery );
  586. }
  587. *ppResults = NULL;
  588. }
  589. else
  590. {
  591. *ppResults = NULL;
  592. }
  593. return hr;
  594. }
  595. }
  596. //-------------------------------------------------------
  597. HRESULT RunRSOPQuery( HWND hParent, LPRSOP_QUERY pQuery, LPRSOP_QUERY_RESULTS* ppResults )
  598. {
  599. return RunRSOPQueryInternal( hParent, NULL, pQuery, ppResults );
  600. }