¡@

Home 

c# Programming Glossary: marshal.freehglobal

Convert a username to a SID string in C#/.NET

http://stackoverflow.com/questions/1040623/convert-a-username-to-a-sid-string-in-c-net

out _use if _rc false _error Marshal.GetLastWin32Error Marshal.FreeHGlobal _sid throw new Exception new Win32Exception _error .Message.. _sidString if _rc false _error Marshal.GetLastWin32Error Marshal.FreeHGlobal _sid throw new Exception new Win32Exception _error .Message..

How to get the logon SID in c#

http://stackoverflow.com/questions/2146153/how-to-get-the-logon-sid-in-c-sharp

TokenInfLength out TokenInfLength if Result Marshal.FreeHGlobal TokenInformation return string.Empty string retVal string.Empty.. Marshal.PtrToStringAuto pstr LocalFree pstr break Marshal.FreeHGlobal TokenInformation return retVal N.B. I tested it on my x64 machine..

How can I pass a pointer to an array using p/invoke in C#?

http://stackoverflow.com/questions/289076/how-can-i-pass-a-pointer-to-an-array-using-p-invoke-in-c

Changing master volume level

http://stackoverflow.com/questions/294292/changing-master-volume-level

rtn.muteCtl mxc.dwControlID break Marshal.FreeHGlobal mlc.pamxctrl return rtn static VOLUME GetVolume MixerInfo mi.. VOLUME Marshal.PtrToStructure mcd.paDetails typeof VOLUME Marshal.FreeHGlobal mcd.paDetails return rtn static bool IsMuted MixerInfo mi MIXERCONTROLDETAILS.. int rtn Marshal.ReadInt32 mcd.paDetails Marshal.FreeHGlobal mcd.paDetails return rtn 0 static void AdjustVolume MixerInfo..

Split string containing command-line parameters into string[] in C#

http://stackoverflow.com/questions/298830/split-string-containing-command-line-parameters-into-string-in-c-sharp

How to convert a structure to a byte array in C#?

http://stackoverflow.com/questions/3278827/how-to-convert-a-structure-to-a-byte-array-in-c

str ptr true Marshal.Copy ptr arr 0 size Marshal.FreeHGlobal ptr return arr And to convert it back CIFSPacket fromBytes byte.. size str CIFSPacket Marshal.PtrToStructure ptr str.GetType Marshal.FreeHGlobal ptr return str In your structure you will need to put this before..

How do I disable a system device programatically?

http://stackoverflow.com/questions/4097000/how-do-i-disable-a-system-device-programatically

How to get IntPtr from byte[] in C#

http://stackoverflow.com/questions/537573/how-to-get-intptr-from-byte-in-c-sharp

bytes 0 unmanagedPointer bytes.Length Call unmanaged code Marshal.FreeHGlobal unmanagedPointer Alternatively you could declare a struct with..

Using C#, how does one figure out what process locked a file?

http://stackoverflow.com/questions/860656/using-c-how-does-one-figure-out-what-process-locked-a-file

Marshal.PtrToStructure ipBasic objBasic.GetType Marshal.FreeHGlobal ipBasic IntPtr ipObjectType Marshal.AllocHGlobal objBasic.TypeInformationLength.. Console.WriteLine nLength returned at zero return null Marshal.FreeHGlobal ipObjectType ipObjectType Marshal.AllocHGlobal nLength objObjectType.. Marshal.PtrToStringUni ipTemp objObjectType.Name.Length 1 Marshal.FreeHGlobal ipObjectType if strObjectTypeName File return null nLength..