From 8a661752eefd670c32e9122ac60a70ceeb701b4a Mon Sep 17 00:00:00 2001 From: Ian C Date: Sun, 16 Oct 2005 12:49:25 +0000 Subject: Added win32 module --- win32.mod/.cvsignore | 6 +++ win32.mod/noddybox.win32.c | 29 +++++++++++++++ win32.mod/win32.bmx | 93 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 128 insertions(+) create mode 100644 win32.mod/.cvsignore create mode 100644 win32.mod/noddybox.win32.c create mode 100644 win32.mod/win32.bmx (limited to 'win32.mod') diff --git a/win32.mod/.cvsignore b/win32.mod/.cvsignore new file mode 100644 index 0000000..dd78089 --- /dev/null +++ b/win32.mod/.cvsignore @@ -0,0 +1,6 @@ +win32.release.win32.i +win32.debug.win32.a +win32.debug.win32.i +win32.release.win32.a +.bmx +doc diff --git a/win32.mod/noddybox.win32.c b/win32.mod/noddybox.win32.c new file mode 100644 index 0000000..5968416 --- /dev/null +++ b/win32.mod/noddybox.win32.c @@ -0,0 +1,29 @@ +#include + +int W32GetLogicalDrives_C(void) +{ + return GetLogicalDrives(); +} + +int W32GetDriveType_C(const char *root) +{ + switch(GetDriveType(root)) + { + case DRIVE_UNKNOWN: + return 0; + case DRIVE_NO_ROOT_DIR: + return 1; + case DRIVE_REMOVABLE: + return 2; + case DRIVE_FIXED: + return 3; + case DRIVE_REMOTE: + return 4; + case DRIVE_CDROM: + return 5; + case DRIVE_RAMDISK: + return 6; + default: + return 0; + } +} diff --git a/win32.mod/win32.bmx b/win32.mod/win32.bmx new file mode 100644 index 0000000..8f0068f --- /dev/null +++ b/win32.mod/win32.bmx @@ -0,0 +1,93 @@ +Rem +bbdoc: noddybox.win32 +EndRem +Module noddybox.win32 + +ModuleInfo "Framework: Some routines I wanted from the Windows API" +ModuleInfo "Copyright: Public Domain" +ModuleInfo "Author: Ian Cowburn" +ModuleInfo "Version: $Revision$" + +' $Id$ + +Strict + +?Win32 +Import "noddybox.win32.c" +? + +Rem +bbdoc: Returned from GetDriveType() for unknown types. +EndRem +Const DRIVETYPE_UNKNOWN:Int=0 +Rem +bbdoc: Returned from GetDriveType() for invalid root paths. +EndRem +Const DRIVETYPE_NO_ROOT_DIR:Int=1 +Rem +bbdoc: Returned from GetDriveType() for removeable drives. +EndRem +Const DRIVETYPE_REMOVABLE:Int=2 +Rem +bbdoc: Returned from GetDriveType() for fixed drives. +EndRem +Const DRIVETYPE_FIXED:Int=3 +Rem +bbdoc: Returned from GetDriveType() for networked drives. +EndRem +Const DRIVETYPE_REMOTE:Int=4 +Rem +bbdoc: Returned from GetDriveType() for CD-ROM drives. +EndRem +Const DRIVETYPE_CDROM:Int=5 +Rem +bbdoc: Returned from GetDriveType() for RAM disks. +EndRem +Const DRIVETYPE_RAMDISK:Int=6 + +Rem +bbdoc: Returns a bitmask of the drives on the system +about: Returns a bitmask where a bit set indicates the presence of a drive letter. Bit 0 is A:, 1 is B: and so on. +about: On Linux and MacOS should return 0. +EndRem +Function W32GetLogicalDrives:Int() + Return W32GetLogicalDrives_C() +End Function + +Rem +bbdoc: Returns a drive type +about: Returns a DRIVETYPE_ constants given a root path in @root +about: On Linux and MacOS should return DRIVETYPE_UNKNOWN. +EndRem +Function W32GetDriveType:Int(root:String) + Return W32GetDriveType_C(root.ToCString()) +End Function + +Private + +?Win32 +Extern + Function W32GetLogicalDrives_C:Int() + + Rem + bbdoc: Returns a drive type + about: Returns a DRIVETYPE_ constants given a root path in @root + about: On Linux and MacOS should return DRIVETYPE_UNKNOWN. + EndRem + Function W32GetDriveType_C:Int(root:Byte Ptr) +EndExtern +?Linux +Function W32GetLogicalDrives_C:Int() + Return 0 +End Function +Function W32GetDriveType_C:Int(root:Byte Ptr) + Return DRIVETYPE_UNKNOWN +End Function +?MacOS +Function W32GetLogicalDrives_C:Int() + Return 0 +End Function +Function W32GetDriveType_C:Int(root:Byte Ptr) + Return DRIVETYPE_UNKNOWN +End Function +? -- cgit v1.2.3