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.

1570 lines
48 KiB

  1. //=============================================================================
  2. // userenv.h - Header file for user environment API.
  3. // User Profiles, environment variables, and Group Policy
  4. //
  5. // Copyright (c) Microsoft Corporation 1995-2002
  6. // All rights reserved
  7. //
  8. //=============================================================================
  9. #ifndef _INC_USERENVP
  10. #define _INC_USERENVP
  11. #ifdef __cplusplus
  12. extern "C" {
  13. #endif
  14. #define PI_LITELOAD 0x00000004 // Lite load of the profile (for system use only)
  15. #define PI_HIDEPROFILE 0x00000008 // Mark the profile as super hidden
  16. #ifndef _USERENV_NO_LINK_APIS_
  17. //=============================================================================
  18. //
  19. // Internal flags for RSoP WMI providers
  20. //
  21. //=============================================================================
  22. // planning mode provider flags
  23. #define FLAG_INTERNAL_MASK 0x01FFFFFF
  24. //=============================w================================================
  25. //
  26. // CreateGroup
  27. //
  28. // Creates a program group on the start menu
  29. //
  30. // lpGroupName - Name of group
  31. // bCommonGroup - Common or personal group
  32. //
  33. // Returns: TRUE if successful
  34. // FALSE if not. Call GetLastError() for more details
  35. //
  36. //=============================================================================
  37. USERENVAPI
  38. BOOL
  39. WINAPI
  40. CreateGroupA(
  41. IN LPCSTR lpGroupName,
  42. IN BOOL bCommonGroup);
  43. USERENVAPI
  44. BOOL
  45. WINAPI
  46. CreateGroupW(
  47. IN LPCWSTR lpGroupName,
  48. IN BOOL bCommonGroup);
  49. #ifdef UNICODE
  50. #define CreateGroup CreateGroupW
  51. #else
  52. #define CreateGroup CreateGroupA
  53. #endif // !UNICODE
  54. //=============================================================================
  55. //
  56. // CreateGroupEx
  57. //
  58. // Creates a program group on the start menu
  59. //
  60. // lpGroupName - Name of group
  61. // bCommonGroup - Common or personal group
  62. // lpResourceModuleName - Name of the resource module.
  63. // uResourceID - Resource ID for the MUI display name.
  64. //
  65. // Returns: TRUE if successful
  66. // FALSE if not. Call GetLastError() for more details
  67. //
  68. //=============================================================================
  69. USERENVAPI
  70. BOOL
  71. WINAPI
  72. CreateGroupExA(
  73. IN LPCSTR lpGroupName,
  74. IN BOOL bCommonGroup,
  75. IN LPCSTR lpResourceModuleName,
  76. IN UINT uResourceID);
  77. USERENVAPI
  78. BOOL
  79. WINAPI
  80. CreateGroupExW(
  81. IN LPCWSTR lpGroupName,
  82. IN BOOL bCommonGroup,
  83. IN LPCWSTR lpResourceModuleName,
  84. IN UINT uResourceID);
  85. #ifdef UNICODE
  86. #define CreateGroupEx CreateGroupExW
  87. #else
  88. #define CreateGroupEx CreateGroupExA
  89. #endif // !UNICODE
  90. //=============================================================================
  91. //
  92. // DeleteGroup
  93. //
  94. // Deletes a program group on the start menu and all of its contents
  95. //
  96. // lpGroupName - Name of group
  97. // bCommonGroup - Common or personal group
  98. //
  99. // Returns: TRUE if successful
  100. // FALSE if not. Call GetLastError() for more details
  101. //
  102. // Note: This function uses a delnode routine. Make sure you really want
  103. // to delete the group before you call this function.
  104. //
  105. //=============================================================================
  106. USERENVAPI
  107. BOOL
  108. WINAPI
  109. DeleteGroupA(
  110. IN LPCSTR lpGroupName,
  111. IN BOOL bCommonGroup);
  112. USERENVAPI
  113. BOOL
  114. WINAPI
  115. DeleteGroupW(
  116. IN LPCWSTR lpGroupName,
  117. IN BOOL bCommonGroup);
  118. #ifdef UNICODE
  119. #define DeleteGroup DeleteGroupW
  120. #else
  121. #define DeleteGroup DeleteGroupA
  122. #endif // !UNICODE
  123. //=============================================================================
  124. //
  125. // AddItem
  126. //
  127. // Creates an item on the Programs portion of the Start Menu in the
  128. // requested group.
  129. //
  130. // lpGroupName - Name of group
  131. // bCommonGroup - Common or personal group
  132. // lpFileName - Name of link without the .lnk extension (eg: Notepad)
  133. // lpCommandLine - Command line of target path (eg: notepad.exe)
  134. // lpIconPath - Optional icon path, can be NULL.
  135. // iIconIndex - Optional icon index, default to 0.
  136. // lpWorkingDirectory - Working directory when target is invoked, can be NULL
  137. // wHotKey - Hot key for the link file, default to 0
  138. // iShowCmd - Specifies how the application should be launched.
  139. // Use a default of SW_SHOWNORMAL
  140. //
  141. // Returns: TRUE if successful
  142. // FALSE if not. Call GetLastError() for more details
  143. //
  144. // Notes: New applications should use the CreateLinkFile() function instead
  145. // of AddItem. This allows for friendly tooltip descriptions.
  146. //
  147. // The lpFileName argument should not include the .lnk extension.
  148. // This function will add the extension.
  149. //
  150. // If the lpWorkingDirectory parameter is NULL, this function will
  151. // insert the home directory environment variables
  152. //
  153. // If the requested group doesn't exist, it will be created.
  154. //
  155. // If the lpCommandLine target is located below the system root,
  156. // the SystemRoot environment variable will be inserted into the path
  157. //
  158. // Here's a sample of how this function is typically called:
  159. //
  160. // AddItem (TEXT("Accessories"), FALSE, TEXT("Notepad"),
  161. // TEXT("notepad.exe"), NULL, 0, NULL, 0, SW_SHOWNORMAL);
  162. //
  163. // This function should only be used the Windows NT team. Developers
  164. // outside of the Windows NT team can use the IShellLink interface
  165. // to create link files.
  166. //
  167. //=============================================================================
  168. USERENVAPI
  169. BOOL
  170. WINAPI
  171. AddItemA(
  172. IN LPCSTR lpGroupName,
  173. IN BOOL bCommonGroup,
  174. IN LPCSTR lpFileName,
  175. IN LPCSTR lpCommandLine,
  176. IN LPCSTR lpIconPath,
  177. IN INT iIconIndex,
  178. IN LPCSTR lpWorkingDirectory,
  179. IN WORD wHotKey,
  180. IN INT iShowCmd);
  181. USERENVAPI
  182. BOOL
  183. WINAPI
  184. AddItemW(
  185. IN LPCWSTR lpGroupName,
  186. IN BOOL bCommonGroup,
  187. IN LPCWSTR lpFileName,
  188. IN LPCWSTR lpCommandLine,
  189. IN LPCWSTR lpIconPath,
  190. IN INT iIconIndex,
  191. IN LPCWSTR lpWorkingDirectory,
  192. IN WORD wHotKey,
  193. IN INT iShowCmd);
  194. #ifdef UNICODE
  195. #define AddItem AddItemW
  196. #else
  197. #define AddItem AddItemA
  198. #endif // !UNICODE
  199. //=============================================================================
  200. //
  201. // DeleteItem
  202. //
  203. // Deletes an item on the Programs portion of the Start Menu in the
  204. // requested group.
  205. //
  206. // lpGroupName - Name of group
  207. // bCommonGroup - Common or personal group
  208. // lpFileName - Name of link without the .lnk extension (eg: Notepad)
  209. // bDeleteGroup - After deleting the link, delete the group if its empty.
  210. //
  211. // Returns: TRUE if successful
  212. // FALSE if not. Call GetLastError() for more details
  213. //
  214. // Notes: New applications should use the DeleteLinkFile() function instead
  215. // of DeleteItem.
  216. //
  217. // The lpFileName argument should not include the .lnk extension.
  218. // This function will add the extension.
  219. //
  220. // Here's a sample of how this function is typically called:
  221. //
  222. // DeleteItem (TEXT("Accessories"), FALSE, TEXT("Notepad"), TRUE);
  223. //
  224. // This function should only be used the Windows NT team. Developers
  225. // outside of the Windows NT team can use the IShellLink interface
  226. // to create link files and DeleteFile to delete them.
  227. //
  228. //=============================================================================
  229. USERENVAPI
  230. BOOL
  231. WINAPI
  232. DeleteItemA(
  233. IN LPCSTR lpGroupName,
  234. IN BOOL bCommonGroup,
  235. IN LPCSTR lpFileName,
  236. IN BOOL bDeleteGroup);
  237. USERENVAPI
  238. BOOL
  239. WINAPI
  240. DeleteItemW(
  241. IN LPCWSTR lpGroupName,
  242. IN BOOL bCommonGroup,
  243. IN LPCWSTR lpFileName,
  244. IN BOOL bDeleteGroup);
  245. #ifdef UNICODE
  246. #define DeleteItem DeleteItemW
  247. #else
  248. #define DeleteItem DeleteItemA
  249. #endif // !UNICODE
  250. //=============================================================================
  251. //
  252. // AddDesktopItem
  253. //
  254. // Creates an item on desktop. This function is very similar to AddItem()
  255. // documented above. See that function for more information.
  256. //
  257. // Notes: New applications should use the CreateLinkFile() function instead
  258. // of AddItem. This allows for friendly tooltip descriptions.
  259. //
  260. // This function should only be used the Windows NT team. Developers
  261. // outside of the Windows NT team can use the IShellLink interface
  262. // to create link files.
  263. //
  264. //=============================================================================
  265. USERENVAPI
  266. BOOL
  267. WINAPI
  268. AddDesktopItemA(
  269. IN BOOL bCommonItem,
  270. IN LPCSTR lpFileName,
  271. IN LPCSTR lpCommandLine,
  272. IN LPCSTR lpIconPath,
  273. IN INT iIconIndex,
  274. IN LPCSTR lpWorkingDirectory,
  275. IN WORD wHotKey,
  276. IN INT iShowCmd);
  277. USERENVAPI
  278. BOOL
  279. WINAPI
  280. AddDesktopItemW(
  281. IN BOOL bCommonItem,
  282. IN LPCWSTR lpFileName,
  283. IN LPCWSTR lpCommandLine,
  284. IN LPCWSTR lpIconPath,
  285. IN INT iIconIndex,
  286. IN LPCWSTR lpWorkingDirectory,
  287. IN WORD wHotKey,
  288. IN INT iShowCmd);
  289. #ifdef UNICODE
  290. #define AddDesktopItem AddDesktopItemW
  291. #else
  292. #define AddDesktopItem AddDesktopItemA
  293. #endif // !UNICODE
  294. //=============================================================================
  295. //
  296. // DeleteDesktopItem
  297. //
  298. // Deletes an item from the desktop. This function is very similar to DeleteItem()
  299. // documented above. See that function for more information.
  300. //
  301. // Notes: New applications should use the DeleteLinkFile() function instead
  302. // of DeleteDesktopItem.
  303. //
  304. // This function should only be used the Windows NT team. Developers
  305. // outside of the Windows NT team can use the IShellLink interface
  306. // to create link files and DeleteFile to delete them.
  307. //
  308. //=============================================================================
  309. USERENVAPI
  310. BOOL
  311. WINAPI
  312. DeleteDesktopItemA(
  313. IN BOOL bCommonItem,
  314. IN LPCSTR lpFileName);
  315. USERENVAPI
  316. BOOL
  317. WINAPI
  318. DeleteDesktopItemW(
  319. IN BOOL bCommonItem,
  320. IN LPCWSTR lpFileName);
  321. #ifdef UNICODE
  322. #define DeleteDesktopItem DeleteDesktopItemW
  323. #else
  324. #define DeleteDesktopItem DeleteDesktopItemA
  325. #endif // !UNICODE
  326. //=============================================================================
  327. //
  328. // CreateLinkFile
  329. //
  330. // Creates a link file (aka shortcut) in the requested special folder or
  331. // subdirectory of a special folder.
  332. //
  333. // csidl - CSIDL_* constant of special folder. See shlobj.h
  334. // lpSubDirectory - Subdirectory name. See note below
  335. // lpFileName - Name of link without the .lnk extension (eg: Notepad)
  336. // lpCommandLine - Command line of target path (eg: notepad.exe)
  337. // lpIconPath - Optional icon path, can be NULL.
  338. // iIconIndex - Optional icon index, default to 0.
  339. // lpWorkingDirectory - Working directory when target is invoked, can be NULL
  340. // wHotKey - Hot key for the link file, default to 0
  341. // iShowCmd - Specifies how the application should be launched.
  342. // Use a default of SW_SHOWNORMAL
  343. // lpDescription - Friendly description of shortcut, can be NULL.
  344. //
  345. // Returns: TRUE if successful
  346. // FALSE if not. Call GetLastError() for more details
  347. //
  348. // Notes: New applications should use this function instead of AddItem or
  349. // AddDesktopItem. This allows for friendly tooltip descriptions.
  350. //
  351. // The link file name is a combination of the first three
  352. // parameters. If a csidl is given, that special folder is
  353. // looked up first, and then the lpSubDirectory is appended to
  354. // it followed by the lpFileName. If csidl is equal to 0, then
  355. // lpSubDirectory should contain the fully qualified path to the
  356. // directory the link file is to be placed in. This allows
  357. // for link files to be be created outside of the scope of a
  358. // shell special folder. The csidl constants are listed in
  359. // shlobj.h or in the Win32 documentation for SHGetSpecialFolderPath.
  360. // Commonly used csidl's will be:
  361. //
  362. // CSIDL_PROGRAMS - Personal Program folder on Start Menu
  363. // CSIDL_COMMON_PROGRAMS - Common Program folder on Start Menu
  364. // CSIDL_DESKTOPDIRECTORY - Personal desktop folder
  365. // CSIDL_COMMON_DESKTOPDIRECTORY - Common desktop folder
  366. //
  367. // The lpFileName argument should not include the .lnk extension.
  368. // This function will add the extension.
  369. //
  370. // If the lpWorkingDirectory parameter is NULL, this function will
  371. // insert home directory environment variables.
  372. //
  373. // If the requested subdirectory doesn't exist, it will be created.
  374. //
  375. // If the lpCommandLine target is located below the system root,
  376. // the SystemRoot environment variable will be inserted into the path
  377. //
  378. // Here's a sample of how this function is typically called:
  379. //
  380. // CreateLinkFile (CSIDL_PROGRAMS, TEXT("Accessories"), TEXT("Notepad"),
  381. // TEXT("notepad.exe"), NULL, 0, NULL, 0, SW_SHOWNORMAL,
  382. // TEXT("A simple word processor."));
  383. //
  384. // This function should only be used the Windows NT team. Developers
  385. // outside of the Windows NT team can use the IShellLink interface
  386. // to create link files.
  387. //
  388. //=============================================================================
  389. #if(WINVER >= 0x0500)
  390. USERENVAPI
  391. BOOL
  392. WINAPI
  393. CreateLinkFileA(
  394. IN INT csidl,
  395. IN LPCSTR lpSubDirectory,
  396. IN LPCSTR lpFileName,
  397. IN LPCSTR lpCommandLine,
  398. IN LPCSTR lpIconPath,
  399. IN INT iIconIndex,
  400. IN LPCSTR lpWorkingDirectory,
  401. IN WORD wHotKey,
  402. IN INT iShowCmd,
  403. IN LPCSTR lpDescription);
  404. USERENVAPI
  405. BOOL
  406. WINAPI
  407. CreateLinkFileW(
  408. IN INT csidl,
  409. IN LPCWSTR lpSubDirectory,
  410. IN LPCWSTR lpFileName,
  411. IN LPCWSTR lpCommandLine,
  412. IN LPCWSTR lpIconPath,
  413. IN INT iIconIndex,
  414. IN LPCWSTR lpWorkingDirectory,
  415. IN WORD wHotKey,
  416. IN INT iShowCmd,
  417. IN LPCWSTR lpDescription);
  418. #ifdef UNICODE
  419. #define CreateLinkFile CreateLinkFileW
  420. #else
  421. #define CreateLinkFile CreateLinkFileA
  422. #endif // !UNICODE
  423. #endif /* WINVER >= 0x0500 */
  424. //=============================================================================
  425. //
  426. // CreateLinkFileEx
  427. //
  428. // Creates a link file (aka shortcut) in the requested special folder or
  429. // subdirectory of a special folder.
  430. //
  431. // csidl - CSIDL_* constant of special folder. See shlobj.h
  432. // lpSubDirectory - Subdirectory name. See note below
  433. // lpFileName - Name of link without the .lnk extension (eg: Notepad)
  434. // lpCommandLine - Command line of target path (eg: notepad.exe)
  435. // lpIconPath - Optional icon path, can be NULL.
  436. // iIconIndex - Optional icon index, default to 0.
  437. // lpWorkingDirectory - Working directory when target is invoked, can be NULL
  438. // wHotKey - Hot key for the link file, default to 0
  439. // iShowCmd - Specifies how the application should be launched.
  440. // Use a default of SW_SHOWNORMAL
  441. // lpDescription - Friendly description of shortcut, can be NULL.
  442. // lpResourceModuleName - Name of the resource module. Can be NULL
  443. // uResourceID - Resource ID for the MUI display name.
  444. //
  445. // Returns: TRUE if successful
  446. // FALSE if not. Call GetLastError() for more details
  447. //
  448. // for additional descriptions look in the description of Createlinkfile above.
  449. //=============================================================================
  450. #if(WINVER >= 0x0500)
  451. USERENVAPI
  452. BOOL
  453. WINAPI
  454. CreateLinkFileExA(
  455. IN INT csidl,
  456. IN LPCSTR lpSubDirectory,
  457. IN LPCSTR lpFileName,
  458. IN LPCSTR lpCommandLine,
  459. IN LPCSTR lpIconPath,
  460. IN INT iIconIndex,
  461. IN LPCSTR lpWorkingDirectory,
  462. IN WORD wHotKey,
  463. IN INT iShowCmd,
  464. IN LPCSTR lpDescription,
  465. IN LPCSTR lpResourceModuleName,
  466. IN UINT uResourceID);
  467. USERENVAPI
  468. BOOL
  469. WINAPI
  470. CreateLinkFileExW(
  471. IN INT csidl,
  472. IN LPCWSTR lpSubDirectory,
  473. IN LPCWSTR lpFileName,
  474. IN LPCWSTR lpCommandLine,
  475. IN LPCWSTR lpIconPath,
  476. IN INT iIconIndex,
  477. IN LPCWSTR lpWorkingDirectory,
  478. IN WORD wHotKey,
  479. IN INT iShowCmd,
  480. IN LPCWSTR lpDescription,
  481. IN LPCWSTR lpResourceModuleName,
  482. IN UINT uResourceID);
  483. #ifdef UNICODE
  484. #define CreateLinkFileEx CreateLinkFileExW
  485. #else
  486. #define CreateLinkFileEx CreateLinkFileExA
  487. #endif // !UNICODE
  488. #endif /* WINVER >= 0x0500 */
  489. //=============================================================================
  490. //
  491. // DeleteLinkFile
  492. //
  493. // Deletes a link file (aka shortcut) in the requested special folder or
  494. // subdirectory of a special folder.
  495. //
  496. // csidl - CSIDL_* constant of special folder. See shlobj.h
  497. // lpSubDirectory - Subdirectory name. See note below
  498. // lpFileName - Name of link without the .lnk extension (eg: Notepad)
  499. // bDeleteSubDirectory - After deleting the link, delete the subdirectory if its empty.
  500. //
  501. // Returns: TRUE if successful
  502. // FALSE if not. Call GetLastError() for more details
  503. //
  504. // Notes: New applications should use this function instead DeleteItem or
  505. // DeleteDesktopItem.
  506. //
  507. // The link file name is a combination of the first three
  508. // parameters. If a csidl is given, that special folder is
  509. // looked up first, and then the lpSubDirectory is appended to
  510. // it followed by the lpFileName. If csidl is equal to 0, then
  511. // lpSubDirectory should contain the fully qualified path to the
  512. // directory the link file is to be placed in. This allows
  513. // for link files to be be deleted outside of the scope of a
  514. // shell special folder. The csidl constants are listed in
  515. // shlobj.h or in the Win32 documentation for SHGetSpecialFolderPath.
  516. // Commonly used csidl's will be:
  517. //
  518. // CSIDL_PROGRAMS - Personal Program folder on Start Menu
  519. // CSIDL_COMMON_PROGRAMS - Common Program folder on Start Menu
  520. // CSIDL_DESKTOPDIRECTORY - Personal desktop folder
  521. // CSIDL_COMMON_DESKTOPDIRECTORY - Common desktop folder
  522. //
  523. // The lpFileName argument should not include the .lnk extension.
  524. // This function will add the extension.
  525. //
  526. // This function should only be used the Windows NT team. Developers
  527. // outside of the Windows NT team can use the IShellLink interface
  528. // to create link files and DeleteFile to delete them.
  529. //
  530. //=============================================================================
  531. #if(WINVER >= 0x0500)
  532. USERENVAPI
  533. BOOL
  534. WINAPI
  535. DeleteLinkFileA(
  536. IN INT csidl,
  537. IN LPCSTR lpSubDirectory,
  538. IN LPCSTR lpFileName,
  539. IN BOOL bDeleteSubDirectory);
  540. USERENVAPI
  541. BOOL
  542. WINAPI
  543. DeleteLinkFileW(
  544. IN INT csidl,
  545. IN LPCWSTR lpSubDirectory,
  546. IN LPCWSTR lpFileName,
  547. IN BOOL bDeleteSubDirectory);
  548. #ifdef UNICODE
  549. #define DeleteLinkFile DeleteLinkFileW
  550. #else
  551. #define DeleteLinkFile DeleteLinkFileA
  552. #endif // !UNICODE
  553. #endif /* WINVER >= 0x0500 */
  554. #endif // _USERENV_NO_LINK_APIS_
  555. //=============================================================================
  556. //
  557. // InitializeProfiles
  558. //
  559. // This function is used by GUI mode setup only and setup repair. It initializes
  560. // the Default User and All User profiles and converts any common groups from
  561. // Program Manager.
  562. //
  563. // bGuiModeSetup - Gui Mode setup or not.
  564. //
  565. //
  566. // Returns: TRUE if successful
  567. // FALSE if not. Call GetLastError() for more details
  568. //
  569. //=============================================================================
  570. USERENVAPI
  571. BOOL
  572. WINAPI
  573. InitializeProfiles(
  574. IN BOOL bGuiModeSetup);
  575. //*************************************************************
  576. //
  577. // CopySystemProfile()
  578. //
  579. // Purpose: Create the system profile information under
  580. // ProfileList entry.
  581. // In case of upgrade copy system profile from older
  582. // location to new location and delete the old system
  583. // profile
  584. //
  585. // Parameters:
  586. //
  587. // Return: TRUE if successful
  588. // FALSE if an error occurs. Call GetLastError()
  589. //
  590. // Comments: This should only be called by GUI mode setup!
  591. //
  592. //*************************************************************
  593. USERENVAPI
  594. BOOL
  595. WINAPI
  596. CopySystemProfile(
  597. IN BOOL bCleanInstall);
  598. //=============================================================================
  599. //
  600. // DetermineProfilesLocation
  601. //
  602. // This function is used by winlogon when GUI mode setup is about to start.
  603. // It sets the correct user profile location in the registry.
  604. //
  605. // bCleanInstall - True if setup is performing a clean install
  606. //
  607. // Returns: TRUE if successful
  608. // FALSE if not. Call GetLastError() for more details
  609. //
  610. //=============================================================================
  611. #if(WINVER >= 0x0500)
  612. USERENVAPI
  613. BOOL
  614. WINAPI
  615. DetermineProfilesLocation(
  616. BOOL bCleanInstall);
  617. #endif /* WINVER >= 0x0500 */
  618. //=============================================================================
  619. //
  620. // CreateUserProfile(Ex)
  621. //
  622. // Creates a user profile for the given user. Used by the Win95 -> NT5
  623. // migration code.
  624. //
  625. // pSid - SID of new user
  626. // lpUserName - User name of new user
  627. // lpUserHive - Registry hive to use (optional, can be NULL)
  628. // lpProfileDir - Receives the user's profile directory (can be NULL)
  629. // dwDirSize - Size of lpProfileDir
  630. // bWin9xUpg - Flag to say whether it is win9x upgrade
  631. //
  632. // Returns: TRUE if successful
  633. // FALSE if not.
  634. //
  635. //=============================================================================
  636. #if(WINVER >= 0x0500)
  637. USERENVAPI
  638. BOOL
  639. WINAPI
  640. CreateUserProfileA(
  641. IN PSID pSid,
  642. IN LPCSTR lpUserName,
  643. IN LPCSTR lpUserHive,
  644. OUT LPSTR lpProfileDir,
  645. IN DWORD dwDirSize);
  646. USERENVAPI
  647. BOOL
  648. WINAPI
  649. CreateUserProfileW(
  650. IN PSID pSid,
  651. IN LPCWSTR lpUserName,
  652. IN LPCWSTR lpUserHive,
  653. OUT LPWSTR lpProfileDir,
  654. IN DWORD dwDirSize);
  655. #ifdef UNICODE
  656. #define CreateUserProfile CreateUserProfileW
  657. #else
  658. #define CreateUserProfile CreateUserProfileA
  659. #endif // !UNICODE
  660. USERENVAPI
  661. BOOL
  662. WINAPI
  663. CreateUserProfileExA(
  664. IN PSID pSid,
  665. IN LPCSTR lpUserName,
  666. IN LPCSTR lpUserHive,
  667. OUT LPSTR lpProfileDir,
  668. IN DWORD dwDirSize,
  669. IN BOOL bWin9xUpg);
  670. USERENVAPI
  671. BOOL
  672. WINAPI
  673. CreateUserProfileExW(
  674. IN PSID pSid,
  675. IN LPCWSTR lpUserName,
  676. IN LPCWSTR lpUserHive,
  677. OUT LPWSTR lpProfileDir,
  678. IN DWORD dwDirSize,
  679. IN BOOL bWin9xUpg);
  680. #ifdef UNICODE
  681. #define CreateUserProfileEx CreateUserProfileExW
  682. #else
  683. #define CreateUserProfileEx CreateUserProfileExA
  684. #endif // !UNICODE
  685. #endif /* WINVER >= 0x0500 */
  686. //=============================================================================
  687. //
  688. // CopyProfileDirectory(Ex)
  689. //
  690. // Multi-threaded user profile coping algorithm.
  691. //
  692. // lpSourceDir - Source directory
  693. // lpDestinationDir - Destination directory
  694. // dwFlags - Flags (defined below)
  695. // ftDelRefTime - Reference time used when deleted extra files
  696. // in a CPD_SYNCHRONIZE operation
  697. // lpExclusionList - List of directories to exclude when copying the
  698. // profile
  699. //
  700. // Returns: TRUE if successful
  701. // FALSE if not.
  702. //
  703. // Notes: When CPD_SYNCHRONIZE is used to copy a profile from one
  704. // location to another, all the files / directories are copied first
  705. // and then extra files in the target directory are deleted. In the
  706. // case of 2 machines using the same roaming profile, it doesn't make
  707. // sense to delete the extra files everytime. If the CPD_USEDELREFTIME
  708. // flag is set, then before deleting a file or directory, the
  709. // time on that file or directory is compared with ftDelRefTime.
  710. // If the time is newer, the file / directory is not deleted because
  711. // it is probably a new file from a different machine. If the
  712. // time is older, the file / directory is deleted.
  713. //
  714. // CopyProfileDirectoryEx can also exclude certain directories
  715. // from the copy. If the CPD_USEEXCLUSIONLIST flag is set and
  716. // lpExclusionList is non-null, the specified directories (and
  717. // their children) will be excuded from the copy. The format
  718. // of this parameter is a semi-colon separated list of directories
  719. // relative to the root of the source profile. For example:
  720. //
  721. // Temporary Internet Files;Temp;Foo\Bar
  722. //
  723. //=============================================================================
  724. //
  725. // Flags for CopyProfileDirectory(Ex)
  726. //
  727. #define CPD_FORCECOPY 0x00000001 // Ignore time stamps and always copy the file
  728. #define CPD_IGNORECOPYERRORS 0x00000002 // Ignore errors and keep going
  729. #define CPD_IGNOREHIVE 0x00000004 // Don't copy registry hive
  730. #define CPD_WIN95HIVE 0x00000008 // Looking for Win 9x registry hive instead of NT registry hive
  731. #define CPD_COPYIFDIFFERENT 0x00000010 // If a file exists in both src and dest with different time stamps, always copy it.
  732. #define CPD_SYNCHRONIZE 0x00000020 // Make dest directory structure indentical to src directory structure (delete extra files and directories)
  733. #define CPD_SLOWCOPY 0x00000040 // Don't use multiple thread. Copy one file at a time.
  734. #define CPD_SHOWSTATUS 0x00000080 // Show progress dialog
  735. #define CPD_CREATETITLE 0x00000100 // Change progress dialog title to Creating... rather than Copying...
  736. #define CPD_COPYHIVEONLY 0x00000200 // Only copy the hive, no other files
  737. #define CPD_USEDELREFTIME 0x00000400 // Use ftDelRefTime parameter in CopyProfileDirectoryEx
  738. #define CPD_USEEXCLUSIONLIST 0x00000800 // Use lpExclusionList parameter in CopyProfileDirectoryEx
  739. #define CPD_SYSTEMFILES 0x00001000 // Only copy files and directories with the system file attribute set
  740. #define CPD_DELDESTEXCLUSIONS 0x00002000 // If a directory that is excluded in the source already exists in the destination, delete it
  741. #define CPD_NONENCRYPTEDONLY 0x00004000 // Copy only non encrypted files
  742. #define CPD_IGNORESECURITY 0x00008000 // Ignore the ACLs etc. on the source files
  743. #define CPD_NOERRORUI 0x00010000 // Do not show the UI if error occurs
  744. #define CPD_SYSTEMDIRSONLY 0x00020000 // Only copy directories with the system file attribute set
  745. #define CPD_IGNOREENCRYPTEDFILES 0x00040000 // Ignore Encrypted files
  746. #define CPD_IGNORELONGFILENAMES 0x00080000 // Ignore files with long file names
  747. #define CPD_USETMPHIVEFILE 0x00100000 // user hive is still loaded
  748. USERENVAPI
  749. BOOL
  750. WINAPI
  751. CopyProfileDirectoryA(
  752. IN LPCSTR lpSourceDir,
  753. IN LPCSTR lpDestinationDir,
  754. IN DWORD dwFlags);
  755. USERENVAPI
  756. BOOL
  757. WINAPI
  758. CopyProfileDirectoryW(
  759. IN LPCWSTR lpSourceDir,
  760. IN LPCWSTR lpDestinationDir,
  761. IN DWORD dwFlags);
  762. #ifdef UNICODE
  763. #define CopyProfileDirectory CopyProfileDirectoryW
  764. #else
  765. #define CopyProfileDirectory CopyProfileDirectoryA
  766. #endif // !UNICODE
  767. USERENVAPI
  768. BOOL
  769. WINAPI
  770. CopyProfileDirectoryExA(
  771. IN LPCSTR lpSourceDir,
  772. IN LPCSTR lpDestinationDir,
  773. IN DWORD dwFlags,
  774. IN LPFILETIME ftDelRefTime,
  775. IN LPCSTR lpExclusionList);
  776. USERENVAPI
  777. BOOL
  778. WINAPI
  779. CopyProfileDirectoryExW(
  780. IN LPCWSTR lpSourceDir,
  781. IN LPCWSTR lpDestinationDir,
  782. IN DWORD dwFlags,
  783. IN LPFILETIME ftDelRefTime,
  784. IN LPCWSTR lpExclusionList);
  785. #ifdef UNICODE
  786. #define CopyProfileDirectoryEx CopyProfileDirectoryExW
  787. #else
  788. #define CopyProfileDirectoryEx CopyProfileDirectoryExA
  789. #endif // !UNICODE
  790. //=============================================================================
  791. //
  792. // MigrateNT4ToNT5
  793. //
  794. // Migrates a user's profile from NT4 to NT5. This function should
  795. // only be called by shmgrate.exe
  796. //
  797. // Returns: TRUE if successful
  798. // FALSE if not.
  799. //
  800. //=============================================================================
  801. #if(WINVER >= 0x0500)
  802. USERENVAPI
  803. BOOL
  804. WINAPI
  805. MigrateNT4ToNT5();
  806. #endif /* WINVER >= 0x0500 */
  807. //=============================================================================
  808. //
  809. // ResetUserSpecialFolderPaths
  810. //
  811. // Sets all of the user special folder paths back to their defaults
  812. //
  813. // Returns: TRUE if successful
  814. // FALSE if not.
  815. //
  816. //=============================================================================
  817. #if(WINVER >= 0x0500)
  818. USERENVAPI
  819. BOOL
  820. WINAPI
  821. ResetUserSpecialFolderPaths();
  822. #endif /* WINVER >= 0x0500 */
  823. //=============================================================================
  824. //
  825. // GetSystemTempDirectory
  826. //
  827. // Gets the system wide temp directory in short form
  828. //
  829. // Returns: TRUE if successful
  830. // FALSE if not.
  831. //
  832. //=============================================================================
  833. USERENVAPI
  834. BOOL
  835. WINAPI
  836. GetSystemTempDirectoryA(
  837. OUT LPSTR lpDir,
  838. IN OUT LPDWORD lpcchSize);
  839. USERENVAPI
  840. BOOL
  841. WINAPI
  842. GetSystemTempDirectoryW(
  843. OUT LPWSTR lpDir,
  844. IN OUT LPDWORD lpcchSize);
  845. #ifdef UNICODE
  846. #define GetSystemTempDirectory GetSystemTempDirectoryW
  847. #else
  848. #define GetSystemTempDirectory GetSystemTempDirectoryA
  849. #endif // !UNICODE
  850. //=============================================================================
  851. //
  852. // ApplySystemPolicy
  853. //
  854. //
  855. // Entry point for Windows NT4 System Policy.
  856. //
  857. // dwFlags - Flags
  858. // hToken - User's token
  859. // hKeyCurrentUser - Registry to the root of the user's hive
  860. // lpUserName - User's name
  861. // lpPolicyPath - Path to the policy file (ntconfig.pol). Can be NULL.
  862. // lpServerName - Domain controller name used for group
  863. // membership look up. Can be NULL.
  864. //
  865. //
  866. // Returns: TRUE if successful
  867. // FALSE if not
  868. //
  869. //=============================================================================
  870. #if(WINVER >= 0x0500)
  871. #define SP_FLAG_APPLY_MACHINE_POLICY 0x00000001
  872. #define SP_FLAG_APPLY_USER_POLICY 0x00000002
  873. USERENVAPI
  874. BOOL
  875. WINAPI
  876. ApplySystemPolicyA(
  877. IN DWORD dwFlags,
  878. IN HANDLE hToken,
  879. IN HKEY hKeyCurrentUser,
  880. IN LPCSTR lpUserName,
  881. IN LPCSTR lpPolicyPath,
  882. IN LPCSTR lpServerName);
  883. USERENVAPI
  884. BOOL
  885. WINAPI
  886. ApplySystemPolicyW(
  887. IN DWORD dwFlags,
  888. IN HANDLE hToken,
  889. IN HKEY hKeyCurrentUser,
  890. IN LPCWSTR lpUserName,
  891. IN LPCWSTR lpPolicyPath,
  892. IN LPCWSTR lpServerName);
  893. #ifdef UNICODE
  894. #define ApplySystemPolicy ApplySystemPolicyW
  895. #else
  896. #define ApplySystemPolicy ApplySystemPolicyA
  897. #endif // !UNICODE
  898. #endif /* WINVER >= 0x0500 */
  899. #if(WINVER >= 0x0500)
  900. //=============================================================================
  901. //
  902. // Data types and data structures for foreground policy refresh info.
  903. //
  904. //=============================================================================
  905. typedef enum _tagFgPolicyRefreshReason
  906. {
  907. GP_ReasonUnknown = 0,
  908. GP_ReasonFirstPolicy,
  909. GP_ReasonCSERequiresSync,
  910. GP_ReasonCSESyncError,
  911. GP_ReasonSyncForced,
  912. GP_ReasonSyncPolicy,
  913. GP_ReasonNonCachedCredentials,
  914. GP_ReasonSKU
  915. } FgPolicyRefreshReason;
  916. typedef enum _tagFgPolicyRefreshMode
  917. {
  918. GP_ModeUnknown = 0,
  919. GP_ModeSyncForeground,
  920. GP_ModeAsyncForeground,
  921. } FgPolicyRefreshMode;
  922. typedef struct _tagFgPolicyRefreshInfo
  923. {
  924. FgPolicyRefreshReason reason;
  925. FgPolicyRefreshMode mode;
  926. } FgPolicyRefreshInfo, *LPFgPolicyRefreshInfo;
  927. //=============================================================================
  928. //
  929. // SetNextFgPolicyRefreshInfo
  930. //
  931. // Sets information about the next foreground policy
  932. //
  933. // szUserSid - user's SID for user's info, 0 for machine info
  934. // info - FgPolicyRefreshInfo structure with the reason and mode info
  935. //
  936. // Returns: WIN32 error code
  937. //
  938. //=============================================================================
  939. USERENVAPI
  940. DWORD
  941. WINAPI
  942. SetNextFgPolicyRefreshInfo( LPWSTR szUserSid,
  943. FgPolicyRefreshInfo info );
  944. //=============================================================================
  945. //
  946. // GetPreviousFgPolicyRefreshInfo
  947. //
  948. // Gets information about the previous foreground policy
  949. //
  950. // szUserSid - user's SID for user's info, 0 for machine info
  951. // pInfo - pointer to the FgPolicyRefreshInfo structure; returns the info
  952. //
  953. // Returns: WIN32 error code
  954. //
  955. //=============================================================================
  956. USERENVAPI
  957. DWORD
  958. WINAPI
  959. GetPreviousFgPolicyRefreshInfo( LPWSTR szUserSid,
  960. FgPolicyRefreshInfo* pInfo );
  961. //=============================================================================
  962. //
  963. // GetNextFgPolicyRefreshInfo
  964. //
  965. // Gets information about the previous foreground policy
  966. //
  967. // szUserSid - user's SID for user's info, 0 for machine info
  968. // pInfo - pointer to the FgPolicyRefreshInfo structure; returns info
  969. //
  970. // Returns: WIN32 error code
  971. //
  972. //=============================================================================
  973. USERENVAPI
  974. DWORD
  975. WINAPI
  976. GetNextFgPolicyRefreshInfo( LPWSTR szUserSid,
  977. FgPolicyRefreshInfo* pInfo );
  978. //=============================================================================
  979. //
  980. // ForceSyncFgPolicy
  981. //
  982. // Forces the next foreground policy to be Synchronous
  983. //
  984. // szUserSid - user's SID for user's info, 0 for machine info
  985. //
  986. // Returns: WIN32 error code
  987. //
  988. //=============================================================================
  989. USERENVAPI
  990. DWORD
  991. WINAPI
  992. ForceSyncFgPolicy( LPWSTR szUserSid );
  993. //=============================================================================
  994. //
  995. // WaitForUserPolicyForegroundProcessing
  996. //
  997. // Blocks the caller until the user foreground policy is finished
  998. //
  999. // Returns: WIN32 error code
  1000. //
  1001. //=============================================================================
  1002. USERENVAPI
  1003. DWORD
  1004. WINAPI
  1005. WaitForUserPolicyForegroundProcessing();
  1006. //=============================================================================
  1007. //
  1008. // WaitForMachinePolicyForegroundProcessing
  1009. //
  1010. // Blocks the caller until the machine foreground policy is finished
  1011. //
  1012. // Returns: WIN32 error code
  1013. //
  1014. //=============================================================================
  1015. USERENVAPI
  1016. DWORD
  1017. WINAPI
  1018. WaitForMachinePolicyForegroundProcessing();
  1019. //=============================================================================
  1020. //
  1021. // IsSyncForegroundPolicyRefresh
  1022. //
  1023. // Called during foreground refresh to determine whether the refresh is sync or
  1024. // async
  1025. //
  1026. // bMachine - user or machine
  1027. // hToken - User or machine token
  1028. //
  1029. // Returns: TRUE if foreground policy should be applied synchronously,
  1030. // FALSE otherwise
  1031. //
  1032. //=============================================================================
  1033. USERENVAPI
  1034. BOOL
  1035. WINAPI
  1036. IsSyncForegroundPolicyRefresh( BOOL bMachine,
  1037. HANDLE hToken );
  1038. #endif /* WINVER >= 0x0500 */
  1039. //=============================================================================
  1040. //
  1041. // ApplyGroupPolicy
  1042. //
  1043. //
  1044. // Entry point for Group Policy. Causes either machine or user
  1045. // policy to be applied.
  1046. //
  1047. // dwFlags - Flags defined below
  1048. // hToken - User or machine token
  1049. // hEvent - Handle to an event which causes the policy thread to
  1050. // terminate when signaled.
  1051. // hKeyRoot - Registry to the root of the correspond hive
  1052. // eg: HKLM or HKCU for the user that matches hToken
  1053. // pStatusCallback - Callback function for displaying status messages
  1054. //
  1055. //
  1056. // Returns: If GP_BACKGROUND_REFRESH is set, a thread handle
  1057. // the process can wait until after signaling for policy
  1058. // to stop. If GPT_BACKGROUND_REFRESH is not set, the
  1059. // return value is 1.
  1060. //
  1061. // In the case of failure, NULL will be returned.
  1062. //
  1063. //=============================================================================
  1064. #if(WINVER >= 0x0500)
  1065. //
  1066. // Flags to the ApplyGroupPolicy() function
  1067. //
  1068. #define GP_MACHINE 0x00000001 // Process for machine (vs user)
  1069. #define GP_BACKGROUND_REFRESH 0x00000002 // Use background thread
  1070. #define GP_APPLY_DS_POLICY 0x00000004 // Apply policy from the DS also
  1071. #define GP_ASYNC_FOREGROUND 0x00000008 // don't wait on network services
  1072. //
  1073. // Flags set by ApplyGroupPolicy() function (do not pass these in)
  1074. //
  1075. #define GP_BACKGROUND_THREAD 0x00010000 // Background thread processing
  1076. #define GP_REGPOLICY_CPANEL 0x00020000 // Something changed in the CP settings
  1077. #define GP_SLOW_LINK 0x00040000 // Slow network connection
  1078. #define GP_VERBOSE 0x00080000 // Verbose output to eventlog
  1079. #define GP_FORCED_REFRESH 0x00100000 // Forced Refresh
  1080. // The 2 bit values were briefly used.
  1081. #define GP_PLANMODE 0x00800000 // Planning mode flag
  1082. USERENVAPI
  1083. HANDLE
  1084. WINAPI
  1085. ApplyGroupPolicy(
  1086. IN DWORD dwFlags,
  1087. IN HANDLE hToken,
  1088. IN HANDLE hEvent,
  1089. IN HKEY hKeyRoot,
  1090. IN PFNSTATUSMESSAGECALLBACK pStatusCallback);
  1091. //=============================================================================
  1092. //
  1093. // GenerateRsopPolicy
  1094. //
  1095. // Generates planning mode Rsop policy for specified target
  1096. //
  1097. // dwFlags - Processing flags
  1098. // bstrMachName - Target computer name
  1099. // bstrNewMachSOM - New machine domain or OU
  1100. // psaMachSecGroups - New machine security groups
  1101. // bstrUserName - Target user name
  1102. // psaUserSecGroups - New user security groups
  1103. // bstrSite - Site of target computer
  1104. // pwszNameSpace - Namespace to write Rsop data
  1105. // pProgress - Progress indicator info
  1106. // pMachGpoFilter - GPO Filters that pass in machine processing
  1107. // pUserGpoFilter - GPO Filters that pass in user processing
  1108. //
  1109. // Return: True if successful, False otherwise
  1110. //
  1111. //=============================================================================
  1112. USERENVAPI
  1113. BOOL
  1114. WINAPI
  1115. GenerateRsopPolicy(
  1116. IN DWORD dwFlags,
  1117. IN BSTR bstrMachName,
  1118. IN BSTR bstrNewMachSOM,
  1119. IN SAFEARRAY *psaMachSecGroups,
  1120. IN BSTR bstrUserName,
  1121. IN BSTR bstrNewUserSOM,
  1122. IN SAFEARRAY *psaUserSecGroups,
  1123. IN BSTR bstrSite,
  1124. IN WCHAR *pwszNameSpace,
  1125. IN LPVOID pProgress,
  1126. IN LPVOID pMachGpoFilter,
  1127. IN LPVOID pUserGpoFilter);
  1128. #endif /* WINVER >= 0x0500 */
  1129. //=============================================================================
  1130. //
  1131. // ShutdownGPOProcessing()
  1132. //
  1133. // Entry point for aborting GPO processing
  1134. //
  1135. // bMachine - Shutdown machine or user processing ?
  1136. //
  1137. // Returns: void
  1138. //
  1139. //=============================================================================
  1140. #if(WINVER >= 0x0500)
  1141. USERENVAPI
  1142. void
  1143. WINAPI
  1144. ShutdownGPOProcessing(
  1145. IN BOOL bMachine);
  1146. #endif /* WINVER >= 0x0500 */
  1147. //=============================================================================
  1148. //
  1149. // PingComputer()
  1150. //
  1151. // Pings the specified computer
  1152. //
  1153. // ipaddr - IP address of the computer in unsigned long form
  1154. // ulSpeed - Data transfer rate
  1155. //
  1156. // Notes: For fast connections (eg: LAN), it isn't possible
  1157. // to get accurate transfer rates since the response
  1158. // time from the computer is less than 10ms. In
  1159. // this case, the function returns ERROR_SUCCESS
  1160. // and ulSpeed is set to 0. If the function returns
  1161. // ERROR_SUCCESS and the ulSpeed argument is non-zero
  1162. // the connections is slower
  1163. //
  1164. // Returns: ERROR_SUCCESS if successful
  1165. // Win32 error code if not
  1166. //
  1167. //=============================================================================
  1168. #if(WINVER >= 0x0500)
  1169. USERENVAPI
  1170. DWORD
  1171. WINAPI
  1172. PingComputer(
  1173. IN ULONG ipaddr,
  1174. OUT ULONG *ulSpeed);
  1175. #endif /* WINVER >= 0x0500 */
  1176. //=============================================================================
  1177. //
  1178. // InitializeUserProfile()
  1179. //
  1180. // Called by winlogon to initialize userenv.dll for loading/unloading user
  1181. // profiles.
  1182. //
  1183. // Returns: fvoid
  1184. //
  1185. //=============================================================================
  1186. #if(WINVER >= 0x0500)
  1187. USERENVAPI
  1188. void
  1189. WINAPI
  1190. InitializeUserProfile();
  1191. #endif /* WINVER >= 0x0500 */
  1192. //=============================================================================
  1193. //
  1194. // EnterUserProfileLock()
  1195. //
  1196. // Get the user profile synchronization lock for a user
  1197. //
  1198. // Returns: HRESULT
  1199. //
  1200. //=============================================================================
  1201. #if(WINVER >= 0x0500)
  1202. USERENVAPI
  1203. DWORD
  1204. WINAPI
  1205. EnterUserProfileLock(LPTSTR pSid);
  1206. #endif /* WINVER >= 0x0500 */
  1207. //=============================================================================
  1208. //
  1209. // LeaveUserProfileLock()
  1210. //
  1211. // Release the user profile synchronization lock for a user
  1212. //
  1213. // Returns: HRESULT
  1214. //
  1215. //=============================================================================
  1216. #if(WINVER >= 0x0500)
  1217. USERENVAPI
  1218. DWORD
  1219. WINAPI
  1220. LeaveUserProfileLock(LPTSTR pSid);
  1221. #endif /* WINVER >= 0x0500 */
  1222. //*************************************************************************
  1223. //
  1224. // SecureUserProfiles()
  1225. //
  1226. // Routine Description :
  1227. // This function secures user profiles during FAT->NTFS conversion.
  1228. // The function loops through all profiles registered under current
  1229. // OS and sets the security for the corresponding profile directory
  1230. // and nested subdirs. Assumption is the function will be called
  1231. // only during FAT->NTFS conversion.
  1232. //
  1233. // Arguments :
  1234. // None.
  1235. //
  1236. // Return Value :
  1237. // None.
  1238. //
  1239. // History: Date Author Comment
  1240. // 8/8/00 santanuc Created
  1241. //
  1242. //*************************************************************************
  1243. #if(WINVER >= 0x0500)
  1244. USERENVAPI
  1245. void
  1246. WINAPI
  1247. SecureUserProfiles(void);
  1248. #endif /* WINVER >= 0x0500 */
  1249. //*************************************************************************
  1250. //
  1251. // CheckAccessForPolicyGeneration()
  1252. //
  1253. // Routine Description :
  1254. // This function checks whether the given user represented by the token
  1255. // has access to generate rsop data (planning or logging)
  1256. //
  1257. // Arguments :
  1258. // hToken - Token of the user
  1259. // szContainer - Container for which access needs to be checked.
  1260. // Should be OU or domain container
  1261. // szDomain - Domaindns where the container exists
  1262. // bLogging - True if the rsop data is to be genearated for
  1263. // logging mode
  1264. // pbAccessGranted - Access Granted or not
  1265. //
  1266. //
  1267. // Return Value :
  1268. // ERROR_SUCCESS on success. Appropriate error code otherwise
  1269. //
  1270. //*************************************************************************
  1271. #if(WINVER >= 0x0500)
  1272. USERENVAPI
  1273. DWORD
  1274. WINAPI
  1275. CheckAccessForPolicyGeneration( HANDLE hToken,
  1276. LPCWSTR szContainer,
  1277. LPWSTR szDomain,
  1278. BOOL bLogging,
  1279. BOOL* pbAccessGranted);
  1280. #endif /* WINVER >= 0x0500 */
  1281. //*************************************************************************
  1282. //
  1283. // GetGroupPolicyNetworkName()
  1284. //
  1285. // Routine Description :
  1286. // This function returns the name of the network from which policy
  1287. // was applied.
  1288. //
  1289. // Arguments :
  1290. // szNetworkName - unicode string buffer representing the network name
  1291. // pdwByteCount - size in bytes of the unicode string buffer
  1292. //
  1293. // Return Value :
  1294. // ERROR_SUCCESS if successful, error code otherwise.
  1295. //
  1296. //*************************************************************************
  1297. #if(WINVER >= 0x0500)
  1298. USERENVAPI
  1299. DWORD
  1300. WINAPI
  1301. GetGroupPolicyNetworkName( LPWSTR szNetworkName, LPDWORD pdwByteCount );
  1302. #endif /* WINVER >= 0x0500 */
  1303. //*************************************************************
  1304. //
  1305. // GetUserAppDataPath()
  1306. //
  1307. // Purpose: Returns the path for user's Appdata.
  1308. //
  1309. // Parameters: hToken - User's token
  1310. // lpFolderPath - Output buffer
  1311. //
  1312. // Return: ERROR_SUCCESS if successful
  1313. // otherwise the error code
  1314. //
  1315. // Comments: If error occurs then lpFolderPath set to empty.
  1316. // Used by Crypto guys to avoid calling SHGetFolderPath.
  1317. //
  1318. //*************************************************************
  1319. #if(WINVER >= 0x0500)
  1320. USERENVAPI
  1321. DWORD
  1322. WINAPI
  1323. GetUserAppDataPathA(
  1324. IN HANDLE hToken,
  1325. IN BOOL fLocalAppData,
  1326. OUT LPSTR lpFolderPath
  1327. );
  1328. USERENVAPI
  1329. DWORD
  1330. WINAPI
  1331. GetUserAppDataPathW(
  1332. IN HANDLE hToken,
  1333. IN BOOL fLocalAppData,
  1334. OUT LPWSTR lpFolderPath
  1335. );
  1336. #ifdef UNICODE
  1337. #define GetUserAppDataPath GetUserAppDataPathW
  1338. #else
  1339. #define GetUserAppDataPath GetUserAppDataPathA
  1340. #endif // !UNICODE
  1341. #endif /* WINVER >= 0x0500 */
  1342. //=============================================================================
  1343. //
  1344. // GetUserProfileDirFromSid
  1345. //
  1346. // Returns the path to the root of the requested user's profile
  1347. //
  1348. // pSid - User's SID returned from LookupAccountName()
  1349. // lpProfileDir - Receives the path
  1350. // lpcchSize - Size of lpProfileDir
  1351. //
  1352. // Returns: TRUE if successful
  1353. // FALSE if not. Call GetLastError() for more details
  1354. //
  1355. // Note: If lpProfileDir is not large enough, the function will fail,
  1356. // and lpcchSize will contain the necessary buffer size.
  1357. //
  1358. // Example return value: C:\Documents and Settings\Joe
  1359. //
  1360. //=============================================================================
  1361. #if(WINVER >= 0x0500)
  1362. USERENVAPI
  1363. BOOL
  1364. WINAPI
  1365. GetUserProfileDirFromSidA(
  1366. IN PSID pSid,
  1367. OUT LPSTR lpProfileDir,
  1368. IN OUT LPDWORD lpcchSize);
  1369. USERENVAPI
  1370. BOOL
  1371. WINAPI
  1372. GetUserProfileDirFromSidW(
  1373. IN PSID pSid,
  1374. OUT LPWSTR lpProfileDir,
  1375. IN OUT LPDWORD lpcchSize);
  1376. #ifdef UNICODE
  1377. #define GetUserProfileDirFromSid GetUserProfileDirFromSidW
  1378. #else
  1379. #define GetUserProfileDirFromSid GetUserProfileDirFromSidA
  1380. #endif // !UNICODE
  1381. #endif /* WINVER >= 0x0500 */
  1382. //=============================================================================
  1383. //
  1384. // CheckXForestLogon()
  1385. //
  1386. // Purpose: Check if the user is logged on to a different forest, if yes, we
  1387. // should disable roaming user profile for the user because of
  1388. // protential security risks. Administrator can set a policy
  1389. // "AllowX-ForestPolicy-and-RUP" to disable this check.
  1390. //
  1391. // Parameters:
  1392. // hTokenUser - user's token
  1393. //
  1394. // Return: S_OK on not x-forest logon, S_FALSE on x-forest logon,
  1395. // else for failure
  1396. //
  1397. // Comments:
  1398. //
  1399. // History: Date Author Comment
  1400. // 05/08/2002 mingzhu Created
  1401. //
  1402. //=============================================================================
  1403. #if(WINVER >= 0x0500)
  1404. USERENVAPI
  1405. HRESULT
  1406. WINAPI
  1407. CheckXForestLogon(IN HANDLE hTokenUser);
  1408. #endif /* WINVER >= 0x0500 */
  1409. #ifdef __cplusplus
  1410. }
  1411. #endif
  1412. #endif // _INC_USERENVP