Source code of Windows XP (NT5)
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.

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