home *** CD-ROM | disk | FTP | other *** search
/ DOS/V Power Report 1997 March / VPR9703B.ISO / driver / canon / shot / pbv120 / disk1 / msdetect.in_ / msdetect.in
Text File  |  1995-03-30  |  12KB  |  345 lines

  1. '**************************************************************************
  2. '*************************  Setup Detect API's  ***************************
  3. '**************************************************************************
  4.  
  5. ''detect
  6.  
  7. DECLARE FUNCTION FFileInUse LIB "msinsstf.dll" (szFile$) AS INTEGER
  8. ''DECLARE FUNCTION CbGetVersionOfFile LIB "msdetstf.dll" (szFile$, szBuf$, cbBuf%) AS INTEGER
  9. DECLARE FUNCTION LGetVersionNthField LIB "msdetstf.dll" (szVersion$, nField%) AS LONG
  10. DECLARE FUNCTION LcbGetSizeOfFile LIB "msdetstf.dll" (szFile$) AS LONG
  11. DECLARE FUNCTION FGetValidDrivesList LIB "msdetstf.dll" (szSymbol$) AS INTEGER
  12. DECLARE FUNCTION FGetLocalHardDrivesList LIB "msdetstf.dll" (szSymbol$) AS INTEGER
  13. DECLARE FUNCTION FGetRemovableDrivesList LIB "msdetstf.dll" (szSymbol$) AS INTEGER
  14. DECLARE FUNCTION FGetNetworkDrivesList LIB "msdetstf.dll" (szSymbol$) AS INTEGER
  15. DECLARE FUNCTION LcbTotalDrive LIB "msdetstf.dll" (nDrive%) AS LONG
  16. DECLARE FUNCTION LcbFreeDrive LIB "msdetstf.dll" (nDrive%) AS LONG
  17. DECLARE FUNCTION FIsValidDrive LIB "msdetstf.dll" (nDrive%) AS INTEGER
  18. DECLARE FUNCTION FIsLocalHardDrive LIB "msdetstf.dll" (nDrive%) AS INTEGER
  19. DECLARE FUNCTION FIsRemoveDrive LIB "msdetstf.dll" (nDrive%) AS INTEGER
  20. DECLARE FUNCTION FIsRemoteDrive LIB "msdetstf.dll" (nDrive%) AS INTEGER
  21. DECLARE FUNCTION FDirExists LIB "msdetstf.dll" (szDir$) AS INTEGER
  22. DECLARE FUNCTION FDoesFileExist LIB "msdetstf.dll" (szFileName$, mode%) AS INTEGER
  23. DECLARE FUNCTION CbGetDateOfFile LIB "msdetstf.dll" (szFile$, szBuf$, cbBuf%) AS INTEGER
  24. DECLARE FUNCTION FDoesIniSectionExist LIB "msdetstf.dll" (szFile$, szSect$) AS INTEGER
  25. DECLARE FUNCTION FDoesIniKeyExist LIB "msdetstf.dll" (szFile$, szSect$, szKey$) AS INTEGER
  26. DECLARE FUNCTION CbGetIniKeyString LIB "msdetstf.dll" (szFile$, szSect$, szKey$, szBuf$, cbBuf%) AS INTEGER
  27. DECLARE FUNCTION WGetDOSMajorVersion LIB "msdetstf.dll" AS INTEGER
  28. DECLARE FUNCTION WGetDOSMinorVersion LIB "msdetstf.dll" AS INTEGER
  29. DECLARE FUNCTION CbGetEnvVariableValue LIB "msdetstf.dll" (szEnvVar$, szBuf$, cbBuf%) AS INTEGER
  30. DECLARE FUNCTION WGetNumWinApps LIB "msdetstf.dll" AS INTEGER
  31. DECLARE FUNCTION FGetParallelPortsList LIB "msdetstf.dll" (szSymbol$) AS INTEGER
  32. DECLARE FUNCTION FGetSerialPortsList LIB "msdetstf.dll" (szSymbol$) AS INTEGER
  33. DECLARE FUNCTION FHas87MathChip LIB "msdetstf.dll" AS INTEGER
  34. DECLARE FUNCTION FHasMonochromeDisplay LIB "msdetstf.dll" AS INTEGER
  35. DECLARE FUNCTION FHasMouseInstalled LIB "msdetstf.dll" AS INTEGER
  36. DECLARE FUNCTION WGetConfigSmartdrvSize LIB "msdetstf.dll" AS INTEGER
  37. DECLARE FUNCTION WGetConfigRamdriveSize LIB "msdetstf.dll" AS INTEGER
  38. DECLARE FUNCTION WGetConfigNumBuffers LIB "msdetstf.dll" AS INTEGER
  39. DECLARE FUNCTION WGetConfigNumFiles LIB "msdetstf.dll" AS INTEGER
  40. DECLARE FUNCTION WGetConfigLastDrive LIB "msdetstf.dll" AS INTEGER
  41. DECLARE FUNCTION FIsDriverInConfig LIB "msdetstf.dll" (szDrv$) AS INTEGER
  42. DECLARE FUNCTION CbFindTargetOnEnvVar LIB "msdetstf.dll" (szFile$, szEnvVar$, szBuf$, cbBuf%) AS INTEGER
  43. DECLARE FUNCTION CbFindFileInTree LIB "msdetstf.dll" (szFile$, szDir$, szBuf$, cbBuf%) AS INTEGER
  44. DECLARE FUNCTION GetTypeFaceNameFromTTF LIB "msdetstf.dll" (szFile$, szBuf$, cbBuf%) AS INTEGER
  45. DECLARE FUNCTION GetExistingFOTFileForTTF LIB "msdetstf.dll" (szFile$, szBuf$, cbBuf%) AS INTEGER
  46.  
  47.  
  48.  
  49. '*************************************************************************
  50. '****************  Detect Basic Wrapper Declarations  ********************
  51. '*************************************************************************
  52.  
  53.  
  54. '' detect
  55.  
  56. DECLARE FUNCTION IsDriveValid (szDrive$) AS INTEGER
  57. DECLARE FUNCTION IsDriveRemovable (szDrive$) AS INTEGER
  58. DECLARE SUB GetValidDrivesList (szSymbol$)
  59. DECLARE SUB GetLocalHardDrivesList (szSymbol$)
  60. DECLARE SUB GetRemovableDrivesList (szSymbol$)
  61. DECLARE FUNCTION GetTotalSpaceForDrive (szDrive$) AS LONG
  62. DECLARE FUNCTION GetFreeSpaceForDrive (szDrive$) AS LONG
  63. DECLARE FUNCTION DoesFileExist (szFile$, mode%) AS INTEGER
  64. DECLARE FUNCTION GetDateOfFile (szFile$) AS STRING
  65. DECLARE FUNCTION GetMonthFromDate (szDate$) AS INTEGER
  66. DECLARE FUNCTION GetSizeOfFile (szFile$) AS LONG
  67. DECLARE FUNCTION FindTargetOnEnvVar (szFile$, szEnvVar$) AS STRING
  68. DECLARE FUNCTION FindFileInTree (szFile$, szDir$) AS STRING
  69. DECLARE FUNCTION DoesDirExist (szDir$) AS INTEGER
  70.  
  71. DECLARE FUNCTION DoesIniSectionExist (szFile$, szSect$) AS INTEGER
  72. DECLARE FUNCTION DoesIniKeyExist (szFile$, szSect$, szKey$) AS INTEGER
  73. DECLARE FUNCTION GetIniKeyString (szFile$, szSect$, szKey$) AS STRING
  74.  
  75. '*************************************************************************
  76. FUNCTION IsDriveValid (szDrive$) STATIC  AS INTEGER
  77. '$ifdef DEBUG
  78.     if FValidDrive(szDrive$) = 0 then
  79.         BadArgErr 1, "IsDriveValid", szDrive$
  80.     end if
  81. '$endif ''DEBUG
  82.     IsDriveValid = FIsValidDrive(ASC(AnsiUpper(szDrive$)) - ASC("A") + 1)
  83. END FUNCTION
  84.  
  85.  
  86. '*************************************************************************
  87. FUNCTION IsDriveRemovable (szDrive$) STATIC  AS INTEGER
  88. '$ifdef DEBUG
  89.     if FValidDrive(szDrive$) = 0 then
  90.         BadArgErr 1, "IsDriveRemovable", szDrive$
  91.     end if
  92. '$endif ''DEBUG
  93.     IsDriveRemovable = FIsRemoveDrive(ASC(AnsiUpper(szDrive$)) - ASC("A") + 1)
  94. END FUNCTION
  95.  
  96.  
  97. '*************************************************************************
  98. FUNCTION GetTotalSpaceForDrive (szDrive$) STATIC  AS LONG
  99. '$ifdef DEBUG
  100.     if FValidDrive(szDrive$) = 0 then
  101.         BadArgErr 1, "GetTotalSpaceForDrive", szDrive$
  102.     end if
  103. '$endif ''DEBUG
  104.     GetTotalSpaceForDrive = LcbTotalDrive(ASC(AnsiUpper(szDrive$)) - ASC("A") + 1)
  105. END FUNCTION
  106.  
  107.  
  108. '*************************************************************************
  109. FUNCTION GetFreeSpaceForDrive (szDrive$) STATIC  AS LONG
  110. '$ifdef DEBUG
  111.     if FValidDrive(szDrive$) = 0 then
  112.         BadArgErr 1, "GetFreeSpaceForDrive", szDrive$
  113.     end if
  114. '$endif ''DEBUG
  115.     GetFreeSpaceForDrive = LcbFreeDrive(ASC(AnsiUpper(szDrive$)) - ASC("A") + 1)
  116. END FUNCTION
  117.  
  118.  
  119. '*************************************************************************
  120. SUB GetValidDrivesList (szSymbol$) STATIC
  121. '$ifdef DEBUG
  122.     if szSymbol$ = "" then
  123.         BadArgErr 1, "GetValidDrivesList", szSymbol$
  124.     end if
  125. '$endif ''DEBUG
  126.     if FGetValidDrivesList(szSymbol$) = 0 then
  127. '$ifdef DEBUG
  128.         StfApiErr saeFail, "GetValidDrivesList", szSymbol$
  129. '$endif ''DEBUG
  130.         ERROR STFERR
  131.     end if
  132. END SUB
  133.  
  134.  
  135. '*************************************************************************
  136. SUB GetLocalHardDrivesList (szSymbol$) STATIC
  137. '$ifdef DEBUG
  138.     if szSymbol$ = "" then
  139.         BadArgErr 1, "GetLocalHardDrivesList", szSymbol$
  140.     end if
  141. '$endif ''DEBUG
  142.     if FGetLocalHardDrivesList(szSymbol$) = 0 then
  143. '$ifdef DEBUG
  144.         StfApiErr saeFail, "GetLocalHardDrivesList", szSymbol$
  145. '$endif ''DEBUG
  146.         ERROR STFERR
  147.     end if
  148. END SUB
  149.  
  150.  
  151. '*************************************************************************
  152. SUB GetRemovableDrivesList (szSymbol$) STATIC
  153. '$ifdef DEBUG
  154.     if szSymbol$ = "" then
  155.         BadArgErr 1, "GetRemovableDrivesList", szSymbol$
  156.     end if
  157. '$endif ''DEBUG
  158.     if FGetRemovableDrivesList(szSymbol$) = 0 then
  159. '$ifdef DEBUG
  160.         StfApiErr saeFail, "GetRemovableDrivesList", szSymbol$
  161. '$endif ''DEBUG
  162.         ERROR STFERR
  163.     end if
  164. END SUB
  165.  
  166.  
  167. '*************************************************************************
  168. FUNCTION DoesFileExist (szFileName$, mode%) STATIC  AS INTEGER
  169. '$ifdef DEBUG
  170.     if FValidFATPath(szFileName$) = 0 then
  171.         BadArgErr 1, "DoesFileExist", szFileName$+", "+STR$(mode%)
  172.     end if
  173. '$endif ''DEBUG
  174.     DoesFileExist = FDoesFileExist(szFileName$, mode%)
  175. END FUNCTION
  176.  
  177.  
  178. '*************************************************************************
  179. FUNCTION GetDateOfFile (szFile$) STATIC  AS STRING
  180. '$ifdef DEBUG
  181.     if FValidFATPath(szFile$) = 0 then
  182.         BadArgErr 1, "GetDateOfFile", szFile$
  183.     end if
  184. '$endif ''DEBUG
  185.     cb% = 20
  186.     szBuf$ = STRING$(cb%, 32)
  187.     cbRet% = CbGetDateOfFile(szFile$, szBuf$, cb%)
  188.     GetDateOfFile = szBuf$
  189. '$ifdef DEBUG
  190.     IF cbRet% >= cb% THEN
  191.         StfApiErr saeOvfl, "GetDateOfFile", szFile$
  192.         ERROR STFERR
  193.     END IF
  194. '$endif ''DEBUG
  195.     szBuf$ = ""
  196. END FUNCTION
  197.  
  198.  
  199. '*************************************************************************
  200. FUNCTION GetSizeOfFile (szFile$) STATIC  AS LONG
  201. '$ifdef DEBUG
  202.     if FValidFATPath(szFile$) = 0 then
  203.         BadArgErr 1, "GetSizeOfFile", szFile$
  204.     end if
  205. '$endif ''DEBUG
  206.     GetSizeOfFile = LcbGetSizeOfFile(szFile$)
  207. END FUNCTION
  208.  
  209.  
  210. '*************************************************************************
  211. FUNCTION FindTargetOnEnvVar (szFile$, szEnvVar$) STATIC  AS STRING
  212. '$ifdef DEBUG
  213.     if CchlValidFATSubPath(szFile$) = 0 then
  214.         n% = 1
  215.     elseif szEnvVar$ = "" then
  216.         n% = 2
  217.     else
  218.         n% = 0
  219.     end if
  220.     if n% > 0 then
  221.         BadArgErr n%, "FindTargetOnEnvVar", szFile$+", "+szEnvVar$
  222.     end if
  223. '$endif ''DEBUG
  224.  
  225.     cb% = 512
  226.     szBuf$ = STRING$(cb%, 32)
  227.     cbRet% = CbFindTargetOnEnvVar(szFile$, szEnvVar$, szBuf$, cb%)
  228.     IF cbRet% >= cb% THEN
  229. '$ifdef DEBUG
  230.         StfApiErr saeOvfl, "FindTargetOnEnvVar", szFile$+", "+szEnvVar$
  231. '$endif ''DEBUG
  232.         ERROR STFERR
  233.     END IF
  234.     szBuf$ = RTRIM$(szBuf$)
  235.     IF MID$(szBuf$, 1, 1) = "\" THEN
  236.        szBuf$ = MID$(CURDIR$, 1, 2) + szBuf$
  237.     ELSEIF Len(szBuf$) > 0 AND MID$(szBuf$, 2, 1) <> ":" THEN
  238.        szBuf$ = MID$(CURDIR$, 1, 3) + szBuf$
  239.     END IF
  240.     FindTargetOnEnvVar = szBuf$
  241.     szBuf$ = ""
  242. END FUNCTION
  243.  
  244.  
  245. '*************************************************************************
  246. FUNCTION FindFileInTree (szFile$, szDir$) STATIC  AS STRING
  247. '$ifdef DEBUG
  248.     if CchlValidFATSubPath(szFile$) = 0 then
  249.         n% = 1
  250.     elseif FValidFATDir(szDir$) = 0 then
  251.         n% = 2
  252.     else
  253.         n% = 0
  254.     end if
  255.     if n% > 0 then
  256.         BadArgErr n%, "FindFileInTree", szFile$+", "+szDir$
  257.     end if
  258. '$endif ''DEBUG
  259.  
  260.     cb% = 512
  261.     szBuf$ = STRING$(cb%, 32)
  262.     cbRet% = CbFindFileInTree(szFile$, szDir$, szBuf$, cb%)
  263.     FindFileInTree = szBuf$
  264. '$ifdef DEBUG
  265.     IF cbRet% >= cb% THEN
  266.         StfApiErr saeOvfl, "FindFileInTree", szFile$+", "+szDir$
  267.         ERROR STFERR
  268.     END IF
  269. '$endif ''DEBUG
  270.     szBuf$ = ""
  271. END FUNCTION
  272.  
  273.  
  274. '*************************************************************************
  275. FUNCTION DoesDirExist (szDir$) STATIC  AS INTEGER
  276. '$ifdef DEBUG
  277.     if FValidFATDir(szDir$) = 0 then
  278.         BadArgErr 1, "DoesDirExist", szDir$
  279.     end if
  280. '$endif ''DEBUG
  281.     DoesDirExist = FDirExists(szDir$)
  282. END FUNCTION
  283.  
  284.  
  285. '*************************************************************************
  286. FUNCTION DoesIniSectionExist (szFile$, szSect$) STATIC  AS INTEGER
  287. '$ifdef DEBUG
  288.     if FValidIniFile(szFile$) = 0 then
  289.         BadArgErr 1, "DoesIniSectionExist", szFile$+", "+szSect$
  290.     end if
  291. '$endif ''DEBUG
  292.     DoesIniSectionExist = FDoesIniSectionExist(szFile$, szSect$)
  293. END FUNCTION
  294.  
  295.  
  296. '*************************************************************************
  297. FUNCTION DoesIniKeyExist (szFile$, szSect$, szKey$) STATIC  AS INTEGER
  298. '$ifdef DEBUG
  299.     if FValidIniFile(szFile$) = 0 then
  300.         n% = 1
  301.     elseif szKey$ = "" then
  302.         n% = 3
  303.     else
  304.         n% = 0
  305.     end if
  306.     if n% > 0 then
  307.         BadArgErr n%, "DoesIniKeyExist", szFile$+", "+szSect$+", "+szKey$
  308.     end if
  309. '$endif ''DEBUG
  310.  
  311.     DoesIniKeyExist = FDoesIniKeyExist(szFile$, szSect$, szKey$)
  312. END FUNCTION
  313.  
  314.  
  315. '*************************************************************************
  316. FUNCTION GetIniKeyString (szFile$, szSect$, szKey$) STATIC  AS STRING
  317. '$ifdef DEBUG
  318.     if FValidIniFile(szFile$) = 0 then
  319.         n% = 1
  320.     elseif szKey$ = "" then
  321.         n% = 3
  322.     else
  323.         n% = 0
  324.     end if
  325.     if n% > 0 then
  326.         BadArgErr n%, "GetIniKeyString", szFile$+", "+szSect$+", "+szKey$
  327.     end if
  328. '$endif ''DEBUG
  329.  
  330.     cb% = 512
  331.     szBuf$ = STRING$(cb%, 32)
  332.     cbRet% = CbGetIniKeyString(szFile$, szSect$, szKey$, szBuf$, cb%)
  333.     GetIniKeyString = szBuf$
  334. '$ifdef DEBUG
  335.     IF cbRet% >= cb% THEN
  336.         StfApiErr saeOvfl, "GetIniKeyString", szFile$+", "+szSect$+", "+szKey$
  337.         ERROR STFERR
  338.     END IF
  339. '$endif ''DEBUG
  340.     szBuf$ = ""
  341. END FUNCTION
  342.  
  343.  
  344.  
  345.