This project is read-only.

Captain's Log: 

04/21/2014 Massive overhaul of the MemPtr.vb backend. Most functions have been modified to use dynamically generated methods via delegate, written in IL opcodes, to transfer memory to and from unmanaged memory buffers. Speed increase over p/Invoke is dramatic.

A new experimental library is now included, DTIL, which is MemPtr implemented with many functions coded in pure IL (and ForwardRef'd from the VB source), instead of calling via delegate. This method adds further performance increases. Note: Compiling this library requires the free Visual Studio add-in 'IL Support' to be installed.

Also included in the Interop library is the new VirtualDisk class. Built on top of the raw C-based Windows API, this is a completely new .NET-based implementation of all VHD/VHDX functionality, including creating, mounting and unmounting volumes, as well as providing access to the backing file. There is no demonstration of this feature, yet, but one will be forth-coming.

Several bug fixes, cleaning up of code, and added stability.

02/22/2014 - Added partitioning information to volumes and disks.  For volumes, the new PartitionInfo property presents detailed partition type information (including supported operating systems, alternative usage and entity of origin).  For physical devices, the Partitions property lists all partitions on that device (even foreign partitions such as Linux).  Supports Mbr and Gpt style partition tables. For more information, explore the bottom of DiskApi.vb.  This portion is definitely Alpha: Although it is operational, I do not feel as if it is organized appropriately, quite yet.  Also, I may break DiskDeviceInfo into two classes: DiskDeviceInfo and VolumeDeviceInfo.  This is in the air.  If you depend on this code, please drop me a line.

02/19/2014 - A lot of interesting changes this week.  I'm going through the API, now, and attempting to document it as much as possible.  Added new features at the head of Native.vb that delivers a slew of operating system and basic system information.  The new global readonly variable OSInfo reflects this change.

02/15/2014 - New classes for enumerating through the system file types, and grabbing any sized icon from any dll or exe.  Minor touch-ups to other things (like the IconImage class) and a new exhaustive device enumeration routine (will demonstrate in beta 3).

02/08/2014 - Finally, a release, and an example program is in the release demonstrating just some of what this API can do.  A lot of it is hardware, now... it didn't start out that way, but it turned out that way.  Should come in handy.  Also, if you want to just use the library, it will work just fine with C#.

02/01/2014 - Added a number of full Windows API ports for hardware manipulation, including hardware class enumeration, virtual disk service manipulation and the Volume Shadow Copy service, as well as low level networking and network details enumeration classes.  Most of these functions are declared internal/friend, and so will have to be abstracted or the assembly must be modified.

12/03/2013 - Added TrueType.vb utility module to read a raw TrueType font file from a Stream object, and return the name of the font, GetTTFName() takes the fully-qualified path of a TrueType (or possibly even OpenType) font file, and returns the name.

This is a direct translation/VB-ification from the CodeProject article Retrieving font name from TTF file.

I added a few modifications to discern Big-Endian Unicode-encoded font names, also, utility functions for converting Byte() arrays to structures (and back), BytesToStruct() and StructToBytes().

This module is useful for gathering other font information, too, not just the name.  
More information on the font format can be found here


12/01/2013 - 
Fixed the FILETIME <-> SYSTEMTIME utility functions.  All structures have been completely checked for API compatibility and should actually work.  Changed to all Unicode function calls (no more -A functions or structures).  Added the FILEDESCRIPTOR and ENUMLOGFONTEX structures.  Added a simple CType() wrapper to FILEDESCRIPTOR to automatically pick up information from a file-system file when set to a string value that represents a file that exists.  Fixed some bugs with the NativeMenu class.

Interfaces for the Shell are coming soon!

 

11/25/2013 - This code project is basically a storage place for my version of the API, right now.


I'm currently working on something much more ambitious ... which is dumping much of the Microsoft Codepack API  into Visual Basic.  I am achieving this with good old system reflection and a bit of text jiggery.  Should take me a few weeks if I keep at it.  In reality, I have more things to do with my time than to fiddle with it until I get everything dumped to VB.  It might take me a a month to get around to actually finishing it, have a new PHP/SQL project starting up and I may have to go over to that side for a little while (no matter how much I try to convince my boss we need a Windows app for something).  

Things that I am planning to port over: Interfaces, types, enums, structures and the like.  

Speaking of that, DumpInterface() now exists in the code, somewhere at the bottom.  Only works with ComImport interfaces, but that can be changed.

As far as the abstraction is concerned, I'll leave that to your fancy.  I'll be abstracting the API following the conversion as I need it and posting what I think of as a good wrapper to this site.

Don't worry about the messy condition it's in, right now.  It shall be refactored in the coming months.  For the most part, just take snips (unless you feel like running a bunch o' my code).  



Update 11/24/2013 - Working in the API a lot this weekend ... 
I Have it wrapped into a nice, self-sustaining package.  Got some interfaces built as I needed them for my program.  The grand secret that no-one talks about, after you have queried the IContextMenu, how do you build an Open With (or Open Wit&h, it were) menu.  Well, I got my answer working with IAssocHandler.  The bottom of the WinAPI has the wrapper function I wrote to build the entire menu.  The interfaces and one interface-specific helper function are buried somewhere up above it.  Also got all my icon extraction methods working.  There are 2 GetLibraryIcon functions.  One of them calls LoadLibrary and LoadImage while the other calls ExtractIconEx.  Also fixed the declare for FileIconInit and a wrapper function for opening the properties sheets for a device using rundll32: OpenDeviceProperties() is buried somewhere up in there, too.  

More to come... also ... they never tell you exactly why it's important to specify the pixels per meter fields in a BITMAPINFOHEADER structure until you actually try to render a DIB.  MakeDIBSection() function added.  That is combined with IconToTransparentBitmap to populate the Open With menu.

None of the above-mentioned is included in the Windows Code Pack.

I created an IContextMenu interface in C#.  I'll be porting it over to VB .NET later this evening.

Also, I added my ColorMath module, which, while not perfect, will certainly do the trick.  I seem to be having a problem with floating point precision, but I've been reading some articles on MathIsFun, and I will see about fixing it.  It could be that it's either too precise, or not precise enough.  Not sure which one, yet. This is, after all, color space.  ColorMath has been handy forever.  I first wrote it back in 2001, when VB6 was in its golden years... it was one of my first modules to come over to the other side, and I've rewritten it, recently, to boot.  ColorMath includes everything you need to convert between HSV, CMYK & RGB.

I wonder if they would ever adapt a version back to COM and unmanaged code, like VB 6... 

---


A good healthy chunk of the Windows API as implemented in Visual Basic .NET.

Most of it does work. If something is broken, drop me a line and I will fix it.

There is a large collection of Interop utility functions at the end of the WinAPI.vb file that you can use. They are tested and working. Some of them depend upon my Useful Tools (Mem and Blob), you can get them, here, on my CodePlex site.

The NativeMenus.vb file contains virtualized wrappers for the native menu system.

I do not use some of the procedures, and since I converted them from VB6 a while ago, some of them are untested.

Most of the module is up to date, however, and there is a vast swath of the public constants in this module, and quite a number of subroutines and structures.

One thing I have learned about the MarshalAs attribute .... sometimes it's better not to use it and let the OS figure out what to marshal... sometimes this is true, sometimes it's not. It's been a game of trial and error.

There is no support, no nothing. It's here, as-is. As I continue to update the API for use in my own code, it will grow and parts may start working like they're supposed to. 

No interfaces, yet. Working on that! :-)

(I would publish some of this stuff that's not on pinvoke.net on to that site, but I don't want to do that one-by-one, it's tedious).

Last edited Apr 21, 2014 at 8:53 PM by nmoschkin, version 16