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.

72 lines
1.8 KiB

  1. /****************************************************************************\
  2. EXTPART.C / Factory Mode (FACTORY.EXE)
  3. Microsoft Confidential
  4. Copyright (c) Microsoft Corporation 2001
  5. All rights reserved
  6. Source file for Factory that contains the extend partition state
  7. functions.
  8. 05/2001 - Jason Cohen (JCOHEN)
  9. Added this new source file for factory for extending the system
  10. partition.
  11. \****************************************************************************/
  12. //
  13. // Include File(s):
  14. //
  15. #include "factoryp.h"
  16. //
  17. // Internal Define(s):
  18. //
  19. #define ENV_SYSTEMDRIVE _T("%SystemDrive%")
  20. //
  21. // External Function(s):
  22. //
  23. BOOL ExtendPart(LPSTATEDATA lpStateData)
  24. {
  25. BOOL bRet = TRUE;
  26. LPTSTR lpszDrive;
  27. ULONG uSize;
  28. // Only need to do anything if the key exists.
  29. //
  30. if ( DisplayExtendPart(lpStateData) )
  31. {
  32. // At this point, if anything doesn't work we
  33. // should return FALSE.
  34. //
  35. bRet = FALSE;
  36. // Get the size to use for the partition. If it is one, then just pass
  37. // zero so it uses all the free space. We also need to know the drive
  38. // to extend.
  39. //
  40. uSize = (ULONG) GetPrivateProfileInt(INI_SEC_WBOM_SETTINGS, INI_KEY_WBOM_EXTENDPART, 0, lpStateData->lpszWinBOMPath);
  41. if ( ( uSize > 0 ) &&
  42. ( lpszDrive = AllocateExpand(ENV_SYSTEMDRIVE) ) )
  43. {
  44. bRet = SetupExtendPartition(*lpszDrive, (1 == uSize) ? 0 : uSize);
  45. FREE(lpszDrive);
  46. }
  47. }
  48. return bRet;
  49. }
  50. BOOL DisplayExtendPart(LPSTATEDATA lpStateData)
  51. {
  52. return ( GetPrivateProfileInt(INI_SEC_WBOM_SETTINGS, INI_KEY_WBOM_EXTENDPART, 0, lpStateData->lpszWinBOMPath) > 0 );
  53. }