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.

134 lines
3.7 KiB

  1. ///////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (c) 2001, Microsoft Corporation All rights reserved.
  4. //
  5. // Module Name:
  6. //
  7. // file.h
  8. //
  9. // Abstract:
  10. //
  11. // This file contains the File layout object definition.
  12. //
  13. // Revision History:
  14. //
  15. // 2001-06-20 lguindon Created.
  16. //
  17. ///////////////////////////////////////////////////////////////////////////////
  18. #ifndef _FILE_H_
  19. #define _FILE_H_
  20. ///////////////////////////////////////////////////////////////////////////////
  21. //
  22. // Includes Files.
  23. //
  24. ///////////////////////////////////////////////////////////////////////////////
  25. #include "infparser.h"
  26. ///////////////////////////////////////////////////////////////////////////////
  27. //
  28. // Class definition.
  29. //
  30. ///////////////////////////////////////////////////////////////////////////////
  31. class File
  32. {
  33. public:
  34. File(LPSTR destDir, LPSTR name, LPSTR srcDir, LPSTR srcName, INT dirId)
  35. {
  36. // Compute and copy destination directory.
  37. switch(dirId)
  38. {
  39. case(10):
  40. {
  41. sprintf(m_DestinationDir,"%s",destDir);
  42. m_WindowsDir = TRUE;
  43. break;
  44. }
  45. case(11):
  46. {
  47. sprintf(m_DestinationDir,"System32\\%s",destDir);
  48. m_WindowsDir = TRUE;
  49. break;
  50. }
  51. case(17):
  52. {
  53. sprintf(m_DestinationDir,"Inf\\%s",destDir);
  54. m_WindowsDir = TRUE;
  55. break;
  56. }
  57. case(18):
  58. {
  59. sprintf(m_DestinationDir,"Help\\%s",destDir);
  60. m_WindowsDir = TRUE;
  61. break;
  62. }
  63. case(24):
  64. {
  65. LPSTR index;
  66. index = strchr(destDir, '\\');
  67. sprintf(m_DestinationDir,"%s",index + 1);
  68. m_WindowsDir = FALSE;
  69. break;
  70. }
  71. case(25):
  72. {
  73. sprintf(m_DestinationDir,"%s",destDir);
  74. m_WindowsDir = TRUE;
  75. break;
  76. }
  77. default:
  78. {
  79. sprintf(m_DestinationDir,"%s", destDir);
  80. m_WindowsDir = FALSE;
  81. break;
  82. }
  83. }
  84. //
  85. // Verify that the last character of the destination dir is not '\'
  86. //
  87. if (m_DestinationDir[strlen(m_DestinationDir)-1] == '\\')
  88. {
  89. m_DestinationDir[strlen(m_DestinationDir)-1] = '\0';
  90. }
  91. // Copy destination file name.
  92. sprintf(m_DestinationName,"%s",name);
  93. // Copy source directory.
  94. sprintf(m_SourceDir,"%s",srcDir);
  95. // Copy and correct source name.
  96. sprintf(m_SourceName,"%s",srcName);
  97. if( m_SourceName[_tcslen(m_SourceName)-1] == '_')
  98. {
  99. m_SourceName[_tcslen(m_SourceName)-1] = 'I';
  100. }
  101. // Initialize linked-list pointers.
  102. m_Next = NULL;
  103. m_Previous = NULL;
  104. };
  105. LPSTR getDirectoryDestination() { return(m_DestinationDir); };
  106. LPSTR getName() { return (m_DestinationName); };
  107. LPSTR getSrcDir() { return (m_SourceDir); };
  108. LPSTR getSrcName() { return (m_SourceName); };
  109. BOOL isWindowsDir() { return (m_WindowsDir);}
  110. File* getNext() { return (m_Next); };
  111. File* getPrevious() { return (m_Previous); };
  112. void setNext(File *next) { m_Next = next; };
  113. void setPrevious(File *previous) { m_Previous = previous; };
  114. private:
  115. CHAR m_DestinationName[MAX_PATH];
  116. CHAR m_DestinationDir[MAX_PATH];
  117. CHAR m_SourceName[MAX_PATH];
  118. CHAR m_SourceDir[MAX_PATH];
  119. BOOL m_WindowsDir;
  120. File *m_Next;
  121. File *m_Previous;
  122. };
  123. #endif //_FILE_H_