home *** CD-ROM | disk | FTP | other *** search
/ On Hand / On_Hand_From_Softbank_1994_Release_2_Disc_1_1994.iso / 00083 / s / approach / disk1 / msdetect.in_ / msdetect.bin
Text File  |  1993-08-18  |  16KB  |  484 lines

  1. '**************************************************************************
  2. '*************************  Setup Detect API's  ***************************
  3. '**************************************************************************
  4.  
  5. ''detect
  6.  
  7. DECLARE FUNCTION LcbGetSizeOfFile LIB "msdetstf.dll" (szFile$) AS LONG
  8. DECLARE FUNCTION FGetValidDrivesList LIB "msdetstf.dll" (szSymbol$) AS INTEGER
  9. DECLARE FUNCTION FGetLocalHardDrivesList LIB "msdetstf.dll" (szSymbol$) AS INTEGER
  10. DECLARE FUNCTION FGetRemovableDrivesList LIB "msdetstf.dll" (szSymbol$) AS INTEGER
  11. DECLARE FUNCTION FGetNetworkDrivesList LIB "msdetstf.dll" (szSymbol$) AS INTEGER
  12. DECLARE FUNCTION LcbTotalDrive LIB "msdetstf.dll" (nDrive%) AS LONG
  13. DECLARE FUNCTION LcbFreeDrive LIB "msdetstf.dll" (nDrive%) AS LONG
  14. DECLARE FUNCTION FIsValidDrive LIB "msdetstf.dll" (nDrive%) AS INTEGER
  15. DECLARE FUNCTION FIsLocalHardDrive LIB "msdetstf.dll" (nDrive%) AS INTEGER
  16. DECLARE FUNCTION FIsRemoveDrive LIB "msdetstf.dll" (nDrive%) AS INTEGER
  17. DECLARE FUNCTION FIsRemoteDrive LIB "msdetstf.dll" (nDrive%) AS INTEGER
  18. DECLARE FUNCTION FDirExists LIB "msdetstf.dll" (szDir$) AS INTEGER
  19. DECLARE FUNCTION FDoesFileExist LIB "msdetstf.dll" (szFileName$, mode%) AS INTEGER
  20. DECLARE FUNCTION FDoesIniSectionExist LIB "msdetstf.dll" (szFile$, szSect$) AS INTEGER
  21. DECLARE FUNCTION FDoesIniKeyExist LIB "msdetstf.dll" (szFile$, szSect$, szKey$) AS INTEGER
  22. DECLARE FUNCTION CbGetIniKeyString LIB "msdetstf.dll" (szFile$, szSect$, szKey$, szBuf$, cbBuf%) AS INTEGER
  23. DECLARE FUNCTION WGetDOSMajorVersion LIB "msdetstf.dll" AS INTEGER
  24. DECLARE FUNCTION WGetDOSMinorVersion LIB "msdetstf.dll" AS INTEGER
  25. DECLARE FUNCTION CbGetEnvVariableValue LIB "msdetstf.dll" (szEnvVar$, szBuf$, cbBuf%) AS INTEGER
  26. DECLARE FUNCTION WGetNumWinApps LIB "msdetstf.dll" AS INTEGER
  27. DECLARE FUNCTION FHas87MathChip LIB "msdetstf.dll" AS INTEGER
  28. DECLARE FUNCTION FHasMonochromeDisplay LIB "msdetstf.dll" AS INTEGER
  29. DECLARE FUNCTION FHasMouseInstalled LIB "msdetstf.dll" AS INTEGER
  30. DECLARE FUNCTION WGetConfigSmartdrvSize LIB "msdetstf.dll" AS INTEGER
  31. DECLARE FUNCTION WGetConfigRamdriveSize LIB "msdetstf.dll" AS INTEGER
  32. DECLARE FUNCTION WGetConfigNumBuffers LIB "msdetstf.dll" AS INTEGER
  33. DECLARE FUNCTION WGetConfigNumFiles LIB "msdetstf.dll" AS INTEGER
  34. DECLARE FUNCTION WGetConfigLastDrive LIB "msdetstf.dll" AS INTEGER
  35. DECLARE FUNCTION FIsDriverInConfig LIB "msdetstf.dll" (szDrv$) AS INTEGER
  36. DECLARE FUNCTION CbFindTargetOnEnvVar LIB "msdetstf.dll" (szFile$, szEnvVar$, szBuf$, cbBuf%) AS INTEGER
  37. DECLARE FUNCTION CbFindFileInTree LIB "msdetstf.dll" (szFile$, szDir$, szBuf$, cbBuf%) AS INTEGER
  38. DECLARE FUNCTION GetTypeFaceNameFromTTF LIB "msdetstf.dll" (szFile$, szBuf$, cbBuf%) AS INTEGER
  39. DECLARE FUNCTION GetExistingFOTFileForTTF LIB "msdetstf.dll" (szFile$, szBuf$, cbBuf%) AS INTEGER
  40.  
  41.  
  42.  
  43. '*************************************************************************
  44. '****************  Detect Basic Wrapper Declarations  ********************
  45. '*************************************************************************
  46.  
  47.  
  48. '' detect
  49.  
  50. DECLARE FUNCTION IsDriveValid (szDrive$) AS INTEGER
  51. DECLARE FUNCTION IsDriveLocalHard (szDrive$) AS INTEGER
  52. DECLARE FUNCTION IsDriveRemovable (szDrive$) AS INTEGER
  53. DECLARE FUNCTION IsDriveNetwork (szDrive$) AS INTEGER
  54. DECLARE SUB GetValidDrivesList (szSymbol$)
  55. DECLARE SUB GetLocalHardDrivesList (szSymbol$)
  56. DECLARE SUB GetRemovableDrivesList (szSymbol$)
  57. DECLARE SUB GetNetworkDrivesList (szSymbol$)
  58. DECLARE FUNCTION GetTotalSpaceForDrive (szDrive$) AS LONG
  59. DECLARE FUNCTION GetFreeSpaceForDrive (szDrive$) AS LONG
  60.  
  61. DECLARE FUNCTION GetDOSMajorVersion AS INTEGER
  62. DECLARE FUNCTION GetDOSMinorVersion AS INTEGER
  63. DECLARE FUNCTION GetEnvVariableValue (szEnvVar$) AS STRING
  64. DECLARE FUNCTION GetNumWinApps AS INTEGER
  65.  
  66. DECLARE FUNCTION DoesFileExist (szFile$, mode%) AS INTEGER
  67. DECLARE FUNCTION GetSizeOfFile (szFile$) AS LONG
  68. DECLARE FUNCTION FindTargetOnEnvVar (szFile$, szEnvVar$) AS STRING
  69. DECLARE FUNCTION FindFileInTree (szFile$, szDir$) AS STRING
  70. DECLARE FUNCTION DoesDirExist (szDir$) AS INTEGER
  71.  
  72. DECLARE FUNCTION DoesIniSectionExist (szFile$, szSect$) AS INTEGER
  73. DECLARE FUNCTION DoesIniKeyExist (szFile$, szSect$, szKey$) AS INTEGER
  74. DECLARE FUNCTION GetIniKeyString (szFile$, szSect$, szKey$) AS STRING
  75.  
  76. DECLARE FUNCTION GetConfigSmartdrvSize AS INTEGER
  77. DECLARE FUNCTION GetConfigRamdriveSize AS INTEGER
  78. DECLARE FUNCTION GetConfigNumBuffers AS INTEGER
  79. DECLARE FUNCTION GetConfigNumFiles AS INTEGER
  80. DECLARE FUNCTION GetConfigLastDrive AS STRING
  81. DECLARE FUNCTION IsDriverInConfig (szDrv$) AS INTEGER
  82.  
  83. DECLARE FUNCTION GetProcessorType AS INTEGER
  84. DECLARE FUNCTION Has87MathChip AS INTEGER
  85. DECLARE FUNCTION HasMonochromeDisplay AS INTEGER
  86. DECLARE FUNCTION HasMouseInstalled AS INTEGER
  87.  
  88.  
  89. '*************************************************************************
  90. FUNCTION IsDriveValid (szDrive$) STATIC  AS INTEGER
  91. '$ifdef DEBUG
  92.     if FValidDrive(szDrive$) = 0 then
  93.         BadArgErr 1, "IsDriveValid", szDrive$
  94.     end if
  95. '$endif ''DEBUG
  96.     IsDriveValid = FIsValidDrive(ASC(UCASE$(szDrive$)) - ASC("A") + 1)
  97. END FUNCTION
  98.  
  99.  
  100. '*************************************************************************
  101. FUNCTION IsDriveLocalHard (szDrive$) STATIC  AS INTEGER
  102. '$ifdef DEBUG
  103.     if FValidDrive(szDrive$) = 0 then
  104.         BadArgErr 1, "IsDriveLocalHard", szDrive$
  105.     end if
  106. '$endif ''DEBUG
  107.     IsDriveLocalHard = FIsLocalHardDrive(ASC(UCASE$(szDrive$)) - ASC("A") + 1)
  108. END FUNCTION
  109.  
  110.  
  111. '*************************************************************************
  112. FUNCTION IsDriveRemovable (szDrive$) STATIC  AS INTEGER
  113. '$ifdef DEBUG
  114.     if FValidDrive(szDrive$) = 0 then
  115.         BadArgErr 1, "IsDriveRemovable", szDrive$
  116.     end if
  117. '$endif ''DEBUG
  118.     IsDriveRemovable = FIsRemoveDrive(ASC(UCASE$(szDrive$)) - ASC("A") + 1)
  119. END FUNCTION
  120.  
  121.  
  122. '*************************************************************************
  123. FUNCTION IsDriveNetwork (szDrive$) STATIC  AS INTEGER
  124. '$ifdef DEBUG
  125.     if FValidDrive(szDrive$) = 0 then
  126.         BadArgErr 1, "IsDriveNetwork", szDrive$
  127.     end if
  128. '$endif ''DEBUG
  129.     IsDriveNetwork = FIsRemoteDrive(ASC(UCASE$(szDrive$)) - ASC("A") + 1)
  130. END FUNCTION
  131.  
  132.  
  133. '*************************************************************************
  134. FUNCTION GetTotalSpaceForDrive (szDrive$) STATIC  AS LONG
  135. '$ifdef DEBUG
  136.     if FValidDrive(szDrive$) = 0 then
  137.         BadArgErr 1, "GetTotalSpaceForDrive", szDrive$
  138.     end if
  139. '$endif ''DEBUG
  140.     GetTotalSpaceForDrive = LcbTotalDrive(ASC(UCASE$(szDrive$)) - ASC("A") + 1)
  141. END FUNCTION
  142.  
  143.  
  144. '*************************************************************************
  145. FUNCTION GetFreeSpaceForDrive (szDrive$) STATIC  AS LONG
  146. '$ifdef DEBUG
  147.     if FValidDrive(szDrive$) = 0 then
  148.         BadArgErr 1, "GetFreeSpaceForDrive", szDrive$
  149.     end if
  150. '$endif ''DEBUG
  151.     GetFreeSpaceForDrive = LcbFreeDrive(ASC(UCASE$(szDrive$)) - ASC("A") + 1)
  152. END FUNCTION
  153.  
  154.  
  155. '*************************************************************************
  156. SUB GetValidDrivesList (szSymbol$) STATIC
  157. '$ifdef DEBUG
  158.     if szSymbol$ = "" then
  159.         BadArgErr 1, "GetValidDrivesList", szSymbol$
  160.     end if
  161. '$endif ''DEBUG
  162.     if FGetValidDrivesList(szSymbol$) = 0 then
  163. '$ifdef DEBUG
  164.         StfApiErr saeFail, "GetValidDrivesList", szSymbol$
  165. '$endif ''DEBUG
  166.         ERROR STFERR
  167.     end if
  168. END SUB
  169.  
  170.  
  171. '*************************************************************************
  172. SUB GetLocalHardDrivesList (szSymbol$) STATIC
  173. '$ifdef DEBUG
  174.     if szSymbol$ = "" then
  175.         BadArgErr 1, "GetLocalHardDrivesList", szSymbol$
  176.     end if
  177. '$endif ''DEBUG
  178.     if FGetLocalHardDrivesList(szSymbol$) = 0 then
  179. '$ifdef DEBUG
  180.         StfApiErr saeFail, "GetLocalHardDrivesList", szSymbol$
  181. '$endif ''DEBUG
  182.         ERROR STFERR
  183.     end if
  184. END SUB
  185.  
  186.  
  187. '*************************************************************************
  188. SUB GetRemovableDrivesList (szSymbol$) STATIC
  189. '$ifdef DEBUG
  190.     if szSymbol$ = "" then
  191.         BadArgErr 1, "GetRemovableDrivesList", szSymbol$
  192.     end if
  193. '$endif ''DEBUG
  194.     if FGetRemovableDrivesList(szSymbol$) = 0 then
  195. '$ifdef DEBUG
  196.         StfApiErr saeFail, "GetRemovableDrivesList", szSymbol$
  197. '$endif ''DEBUG
  198.         ERROR STFERR
  199.     end if
  200. END SUB
  201.  
  202.  
  203. '*************************************************************************
  204. SUB GetNetworkDrivesList (szSymbol$) STATIC
  205. '$ifdef DEBUG
  206.     if szSymbol$ = "" then
  207.         BadArgErr 1, "GetNetworkDrivesList", szSymbol$
  208.     end if
  209. '$endif ''DEBUG
  210.     if FGetNetworkDrivesList(szSymbol$) = 0 then
  211. '$ifdef DEBUG
  212.         StfApiErr saeFail, "GetNetworkDrivesList", szSymbol$
  213. '$endif ''DEBUG
  214.         ERROR STFERR
  215.     end if
  216. END SUB
  217.  
  218.  
  219. '*************************************************************************
  220. FUNCTION GetDOSMajorVersion STATIC  AS INTEGER
  221.     GetDOSMajorVersion = WGetDOSMajorVersion
  222. END FUNCTION
  223.  
  224.  
  225. '*************************************************************************
  226. FUNCTION GetDOSMinorVersion STATIC  AS INTEGER
  227.     GetDOSMinorVersion = WGetDOSMinorVersion
  228. END FUNCTION
  229.  
  230.  
  231. '*************************************************************************
  232. FUNCTION GetEnvVariableValue (szEnvVar$) STATIC  AS STRING
  233. '$ifdef DEBUG
  234.     if szEnvVar$ = "" then
  235.         BadArgErr 1, "GetEnvVariableValue", szEnvVar$
  236.     end if
  237. '$endif ''DEBUG
  238.     cb% = 1024
  239.     szBuf$ = STRING$(cb%, 32)
  240.     cbRet% = CbGetEnvVariableValue(szEnvVar$, szBuf$, cb%)
  241.     GetEnvVariableValue = szBuf$
  242. '$ifdef DEBUG
  243.     IF cbRet% >= cb% THEN
  244.         StfApiErr saeOvfl, "GetEnvVariableValue", szEnvVar$
  245.         ERROR STFERR
  246.     END IF
  247. '$endif ''DEBUG
  248.     szBuf$ = ""
  249. END FUNCTION
  250.  
  251.  
  252. '*************************************************************************
  253. FUNCTION GetNumWinApps STATIC  AS INTEGER
  254.     GetNumWinApps = WGetNumWinApps
  255. END FUNCTION
  256.  
  257.  
  258. '*************************************************************************
  259. FUNCTION DoesFileExist (szFileName$, mode%) STATIC  AS INTEGER
  260.     DoesFileExist = FDoesFileExist(szFileName$, mode%)
  261. END FUNCTION
  262.  
  263. '*************************************************************************
  264. FUNCTION GetSizeOfFile (szFile$) STATIC  AS LONG
  265. '$ifdef DEBUG
  266.     if FValidFATPath(szFile$) = 0 then
  267.         BadArgErr 1, "GetSizeOfFile", szFile$
  268.     end if
  269. '$endif ''DEBUG
  270.     GetSizeOfFile = LcbGetSizeOfFile(szFile$)
  271. END FUNCTION
  272.  
  273.  
  274. '*************************************************************************
  275. FUNCTION FindTargetOnEnvVar (szFile$, szEnvVar$) STATIC  AS STRING
  276. '$ifdef DEBUG
  277.     if CchlValidFATSubPath(szFile$) = 0 then
  278.         n% = 1
  279.     elseif szEnvVar$ = "" then
  280.         n% = 2
  281.     else
  282.         n% = 0
  283.     end if
  284.     if n% > 0 then
  285.         BadArgErr n%, "FindTargetOnEnvVar", szFile$+", "+szEnvVar$
  286.     end if
  287. '$endif ''DEBUG
  288.  
  289.     cb% = 512
  290.     szBuf$ = STRING$(cb%, 32)
  291.     cbRet% = CbFindTargetOnEnvVar(szFile$, szEnvVar$, szBuf$, cb%)
  292.     IF cbRet% >= cb% THEN
  293. '$ifdef DEBUG
  294.         StfApiErr saeOvfl, "FindTargetOnEnvVar", szFile$+", "+szEnvVar$
  295. '$endif ''DEBUG
  296.         ERROR STFERR
  297.     END IF
  298.     szBuf$ = RTRIM$(szBuf$)
  299.     IF MID$(szBuf$, 1, 1) = "\" THEN
  300.        szBuf$ = MID$(CURDIR$, 1, 2) + szBuf$
  301.     ELSEIF Len(szBuf$) > 0 AND MID$(szBuf$, 2, 1) <> ":" THEN
  302.        szBuf$ = MID$(CURDIR$, 1, 3) + szBuf$
  303.     END IF
  304.     FindTargetOnEnvVar = szBuf$
  305.     szBuf$ = ""
  306. END FUNCTION
  307.  
  308.  
  309. '*************************************************************************
  310. FUNCTION FindFileInTree (szFile$, szDir$) STATIC  AS STRING
  311. '$ifdef DEBUG
  312.     if CchlValidFATSubPath(szFile$) = 0 then
  313.         n% = 1
  314.     elseif FValidFATDir(szDir$) = 0 then
  315.         n% = 2
  316.     else
  317.         n% = 0
  318.     end if
  319.     if n% > 0 then
  320.         BadArgErr n%, "FindFileInTree", szFile$+", "+szDir$
  321.     end if
  322. '$endif ''DEBUG
  323.  
  324.     cb% = 512
  325.     szBuf$ = STRING$(cb%, 32)
  326.     cbRet% = CbFindFileInTree(szFile$, szDir$, szBuf$, cb%)
  327.     FindFileInTree = szBuf$
  328. '$ifdef DEBUG
  329.     IF cbRet% >= cb% THEN
  330.         StfApiErr saeOvfl, "FindFileInTree", szFile$+", "+szDir$
  331.         ERROR STFERR
  332.     END IF
  333. '$endif ''DEBUG
  334.     szBuf$ = ""
  335. END FUNCTION
  336.  
  337.  
  338. '*************************************************************************
  339. FUNCTION GetConfigSmartdrvSize STATIC  AS INTEGER
  340.     GetConfigSmartdrvSize = WGetConfigSmartdrvSize
  341. END FUNCTION
  342.  
  343.  
  344. '*************************************************************************
  345. FUNCTION GetConfigRamdriveSize STATIC  AS INTEGER
  346.     GetConfigRamdriveSize = WGetConfigRamdriveSize
  347. END FUNCTION
  348.  
  349.  
  350. '*************************************************************************
  351. FUNCTION GetConfigNumBuffers STATIC  AS INTEGER
  352.     GetConfigNumBuffers = WGetConfigNumBuffers
  353. END FUNCTION
  354.  
  355.  
  356. '*************************************************************************
  357. FUNCTION GetConfigNumFiles STATIC  AS INTEGER
  358.     GetConfigNumFiles = WGetConfigNumFiles
  359. END FUNCTION
  360.  
  361.  
  362. '*************************************************************************
  363. FUNCTION GetConfigLastDrive STATIC  AS STRING
  364.     chRet% = WGetConfigLastDrive
  365.     if chRet% = 0 then
  366.         GetConfigLastDrive = ""
  367.     else
  368.         GetConfigLastDrive = CHR$(chRet%)
  369.     end if
  370. END FUNCTION
  371.  
  372.  
  373. '*************************************************************************
  374. FUNCTION IsDriverInConfig (szDrv$) STATIC  AS INTEGER
  375. '$ifdef DEBUG
  376.     if szDrv$ = "" then
  377.         BadArgErr 1, "IsDriverInConfig", szDrv$
  378.     end if
  379. '$endif ''DEBUG
  380.     IsDriverInConfig = FIsDriverInConfig(szDrv$)
  381. END FUNCTION
  382.  
  383.  
  384. '*************************************************************************
  385. FUNCTION GetProcessorType STATIC  AS INTEGER
  386.     GetProcessorType = 0
  387.     longTmp& = GetWinFlags()
  388.     IF longTmp& AND WF_CPU486 THEN
  389.         GetProcessorType = 4
  390.     ELSEIF longTmp& AND WF_CPU386 THEN
  391.         GetProcessorType = 3
  392.     ELSEIF longTmp& AND WF_CPU286 THEN
  393.         GetProcessorType = 2
  394.     ELSEIF longTmp& AND WF_CPU186 THEN
  395.         GetProcessorType = 1
  396.     END IF
  397. END FUNCTION
  398.  
  399.  
  400. '*************************************************************************
  401. FUNCTION Has87MathChip STATIC  AS INTEGER
  402.     Has87MathChip = FHas87MathChip
  403. END FUNCTION
  404.  
  405.  
  406. '*************************************************************************
  407. FUNCTION HasMonochromeDisplay STATIC  AS INTEGER
  408.     HasMonochromeDisplay = FHasMonochromeDisplay
  409. END FUNCTION
  410.  
  411.  
  412. '*************************************************************************
  413. FUNCTION HasMouseInstalled STATIC  AS INTEGER
  414.     HasMouseInstalled = FHasMouseInstalled
  415. END FUNCTION
  416.  
  417.  
  418. '*************************************************************************
  419. FUNCTION DoesDirExist (szDir$) STATIC  AS INTEGER
  420.     DoesDirExist = FDirExists(szDir$)
  421. END FUNCTION
  422.  
  423.  
  424. '*************************************************************************
  425. FUNCTION DoesIniSectionExist (szFile$, szSect$) STATIC  AS INTEGER
  426. '$ifdef DEBUG
  427.     if FValidIniFile(szFile$) = 0 then
  428.         BadArgErr 1, "DoesIniSectionExist", szFile$+", "+szSect$
  429.     end if
  430. '$endif ''DEBUG
  431.     DoesIniSectionExist = FDoesIniSectionExist(szFile$, szSect$)
  432. END FUNCTION
  433.  
  434.  
  435. '*************************************************************************
  436. FUNCTION DoesIniKeyExist (szFile$, szSect$, szKey$) STATIC  AS INTEGER
  437. '$ifdef DEBUG
  438.     if FValidIniFile(szFile$) = 0 then
  439.         n% = 1
  440.     elseif szKey$ = "" then
  441.         n% = 3
  442.     else
  443.         n% = 0
  444.     end if
  445.     if n% > 0 then
  446.         BadArgErr n%, "DoesIniKeyExist", szFile$+", "+szSect$+", "+szKey$
  447.     end if
  448. '$endif ''DEBUG
  449.  
  450.     DoesIniKeyExist = FDoesIniKeyExist(szFile$, szSect$, szKey$)
  451. END FUNCTION
  452.  
  453.  
  454. '*************************************************************************
  455. FUNCTION GetIniKeyString (szFile$, szSect$, szKey$) STATIC  AS STRING
  456. '$ifdef DEBUG
  457.     if FValidIniFile(szFile$) = 0 then
  458.         n% = 1
  459.     elseif szKey$ = "" then
  460.         n% = 3
  461.     else
  462.         n% = 0
  463.     end if
  464.     if n% > 0 then
  465.         BadArgErr n%, "GetIniKeyString", szFile$+", "+szSect$+", "+szKey$
  466.     end if
  467. '$endif ''DEBUG
  468.  
  469.     cb% = 512
  470.     szBuf$ = STRING$(cb%, 32)
  471.     cbRet% = CbGetIniKeyString(szFile$, szSect$, szKey$, szBuf$, cb%)
  472.     GetIniKeyString = szBuf$
  473. '$ifdef DEBUG
  474.     IF cbRet% >= cb% THEN
  475.         StfApiErr saeOvfl, "GetIniKeyString", szFile$+", "+szSect$+", "+szKey$
  476.         ERROR STFERR
  477.     END IF
  478. '$endif ''DEBUG
  479.     szBuf$ = ""
  480. END FUNCTION
  481.  
  482.  
  483.  
  484.