Sign in to follow this  
Followers 0

Windows Data Types

10 posts in this topic

#1 ·  Posted (edited)

Windows Data Types

http://msdn.microsoft.com/en-us/library/aa383751%28VS.85%29.aspx

See full table

http://spreadsheets.google.com/ccc?key=pK5CEcdG9GYGeO7K2dmEcBg

Thes Func Return DLLCall Data Type Only /Failure: Blank string

$MSDN_Type ==> C++ Data Type

Func GeTType($MSDN_Type)
Switch $MSDN_Type
Case 'ATOM'
Return 'WORD'

Case 'BOOL'
Return 'BOOL'

Case 'BOOLEAN'
Return 'BOOLEAN'

Case 'BYTE'
Return 'BYTE'

Case 'CHAR'
Return 'str'

Case 'COLORREF'
Return 'DWORD'

Case 'CONST'
Return 'const'

Case 'DWORD'
Return 'DWORD'

Case 'DWORDLONG'
Return 'ULONG'

Case 'DWORD_PTR'
Return 'DWORD_PTR'

Case 'DWORD32'
Return 'UINT'

Case 'DWORD64'
Return 'INT64'

Case 'FLOAT'
Return 'FLOAT'

Case 'HACCEL'
Return 'HANDLE'

Case 'HALF_PTR'
Return 'ptr'

Case 'HANDLE'
Return 'HANDLE'

Case 'HBITMAP'
Return 'HANDLE'

Case 'HBRUSH'
Return 'HANDLE'

Case 'HCONV'
Return 'HANDLE'

Case 'HCONVLIST'
Return 'HANDLE'

Case 'HCURSOR'
Return 'HICON'

Case 'HDC'
Return 'HANDLE'

Case 'HDDEDATA'
Return 'HANDLE'

Case 'HDESK'
Return 'HANDLE'

Case 'HDROP'
Return 'HANDLE'

Case 'HDWP'
Return 'HANDLE'

Case 'HENHMETAFILE'
Return 'HANDLE'

Case 'HFILE'
Return 'int'

Case 'HFONT'
Return 'HANDLE'

Case 'HGIDOBJ'
Return 'HANDLE'

Case 'HGLOBAL'
Return 'HANDLE'

Case 'HHOOK'
Return 'HANDLE'

Case 'HICON'
Return 'HANDLE'

Case 'HINSTANCE'
Return 'HANDLE'

Case 'HKEY'
Return 'HANDLE'

Case 'HKL'
Return 'HANDLE'

Case 'HLOCAL'
Return 'HANDLE'

Case 'HMENU'
Return 'HANDLE'

Case 'HMETAFILE'
Return 'HANDLE'

Case 'HMODULE'
Return 'HANDLE'

Case 'HMONITOR'
Return 'HANDLE'

Case 'HPALETTE'
Return 'HANDLE'

Case 'HPEN'
Return 'HANDLE'

Case 'HRESULT'
Return 'LONG'

Case 'HRGN'
Return 'HANDLE'

Case 'HRSRC'
Return 'HANDLE'

Case 'HSZ'
Return 'HANDLE'

Case 'HWINSTA'
Return 'HANDLE'

Case 'HWND'
Return 'HWND'

Case 'INT_PTR'
Return 'INT_PTR'

Case 'INT32'
Return 'int'

Case 'INT64'
Return 'INT64'

Case 'LANGID'
Return 'WORD'

Case 'LCID'
Return 'DWORD'

Case 'LGRPID'
Return 'DWORD'

Case 'LONG'
Return 'LONG'

Case 'LONGLONG'
Return 'INT64'

Case 'LONG_PTR'
Return 'LONG_PTR'

Case 'LONG32'
Return 'int'

Case 'LONG64'
Return 'INT64'

Case 'LPARAM'
Return 'LPARAM'

Case 'LPBOOL'
Return 'int*'

Case 'LPBYTE'
Return 'int*'

Case 'LPCOLORREF'
Return 'DWORD*'

Case 'LPCSTR'
Return 'str'

Case 'LPCTSTR'
Return 'str'

Case 'LPCWSTR'
Return 'wstr'

Case 'LPDWORD'
Return 'DWORD*'

Case 'LPHANDLE'
Return 'HANDLE*'

Case 'LPINT'
Return 'int*'

Case 'LPLONG'
Return 'long*'

Case 'LPSTR'
Return 'str'

Case 'LPTSTR'
Return 'str'

Case 'LPVOID'
Return 'ptr'

Case 'LPWORD'
Return 'WORD*'

Case 'LPWSTR'
Return 'wstr'

Case 'LRESULT'
Return 'LRESULT'

Case 'PBOOL'
Return 'BOOL*'

Case 'PBOOLEAN'
Return 'BOOLEAN*'

Case 'PBYTE'
Return 'BYTE*'

Case 'PCHAR'
Return 'str'

Case 'PCSTR'
Return 'str'

Case 'PCTSTR'
Return 'str'

Case 'PCWSTR'
Return 'wstr'

Case 'PDWORD'
Return 'DWORD*'

Case 'PDWORDLONG'
Return 'UINT64'

Case 'PDWORD_PTR'
Return 'DWORD_PTR*'

Case 'PDWORD32'
Return 'UINT*'

Case 'PDWORD64'
Return 'INT64*'

Case 'PFLOAT'
Return 'FLOAT*'

Case 'PHALF_PTR'
Return 'ptr'

Case 'PHANDLE'
Return 'HANDLE*'

Case 'PHKEY'
Return 'HANDLE*'

Case 'PINT'
Return 'int*'

Case 'PINT_PTR'
Return 'INT_PTR*'

Case 'PINT32'
Return 'int*'

Case 'PINT64'
Return 'INT64*'

Case 'PLCID'
Return 'DWORD*'

Case 'PLONG'
Return 'LONG*'

Case 'PLONGLONG'
Return 'INT64*'

Case 'PLONG_PTR'
Return 'LONG_PTR*'

Case 'PLONG32'
Return 'long*'

Case 'PLONG64'
Return 'INT64*'

Case 'POINTER_32'
Return 'ptr'

Case 'POINTER_64'
Return 'ptr'

Case 'POINTER_SIGNED'
Return 'ptr'

Case 'POINTER_UNSIGNED'
Return 'ULONG_PTR'

Case 'PSHORT'
Return 'SHORT*'

Case 'PSIZE_T'
Return 'ULONG_PTR*'

Case 'PSSIZE_T'
Return 'LONG_PTR*'

Case 'PSTR'
Return 'str'

Case 'PTBYTE'
Return 'BYTE*'

Case 'PTCHAR'
Return 'wstr'

Case 'PTSTR'
Return 'wstr'

Case 'PUCHAR'
Return 'BYTE*'

Case 'PUHALF_PTR'
Return 'ptr*'

Case 'PUINT'
Return 'UINT*'

Case 'PUINT_PTR'
Return 'UINT_PTR*'

Case 'PUINT32'
Return 'UINT*'

Case 'PUINT64'
Return 'UINT64*'

Case 'PULONG'
Return 'ULONG*'

Case 'PULONGLONG'
Return 'UINT64*'

Case 'PULONG_PTR'
Return 'ULONG_PTR*'

Case 'PULONG32'
Return 'ULONG*'

Case 'PULONG64'
Return 'UINT64*'

Case 'PUSHORT'
Return 'USHORT*'

Case 'PVOID'
Return 'ptr'

Case 'PWCHAR'
Return 'wstr'

Case 'PWORD'
Return 'WORD*'

Case 'PWSTR'
Return 'wstr'

Case 'SC_HANDLE'
Return 'HANDLE'

Case 'SC_LOCK'
Return 'ptr'

Case 'SERVICE_STATUS_HANDLE'
Return 'HANDLE'

Case 'SHORT'
Return 'SHORT'

Case 'SIZE_T'
Return 'ULONG_PTR'

Case 'SSIZE_T'
Return 'LONG_PTR'

Case 'TBYTE'
Return 'wstr'

Case 'TCHAR'
Return 'wstr'

Case 'UCHAR'
Return 'BYTE'

Case 'UHALF_PTR'
Return 'ptr'

Case 'UINT'
Return 'UINT'

Case 'UINT_PTR'
Return 'UINT_PTR'

Case 'UINT32'
Return 'UINT'

Case 'UINT64'
Return 'UINT64'

Case 'ULONG'
Return 'ULONG'

Case 'ULONGLONG'
Return 'UINT64'

Case 'ULONG_PTR'
Return 'ULONG_PTR'

Case 'ULONG32'
Return 'ULONG'

Case 'ULONG64'
Return 'UINT64'

Case 'UNICODE_STRING'
Return 'ptr'

Case 'USHORT'
Return 'USHORT'

Case 'USN'
Return 'INT64'

Case 'VOID'
Return 'none'

Case 'WCHAR'
Return 'wstr'

Case 'WORD'
Return 'WORD'

Case 'WPARAM'
Return 'WPARAM'

Case Else
Return ""

EndSwitch
EndFunc
Edited by wolf9228

صرح السماء كان هنا

 

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

I hope you didn't convert that to AutoIt by hand :idea:

Shouldn't CALLBACK and WINAPI be stdcall instead of cdecl?

Edited by Kip

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

wolf9228,

You know that you can add more than one case to a line, if it's output is the same?

Example:

Case 'PCHAR', 'PCSTR', 'PCTSTR'
 Return "str"

@Kip, I think he converted by hand.

James

Edited by JamesBrooks

Share this post


Link to post
Share on other sites

#4 ·  Posted

What about SMALL_RECT? http://msdn.microsoft.com/en-us/library/ms686125(VS.85).aspx

I'm guessing its just 'ptr'...

Share this post


Link to post
Share on other sites

#5 ·  Posted

typedef struct _SMALL_RECT {
 SHORT Left;
 SHORT Top;
 SHORT Right;
 SHORT Bottom;
} SMALL_RECT;

SMALL_RECT is a struct. So to pass it, you would create it using DllStructCreate, fill in the values, and use DllStructGetPtr to pass the pointer to the struct to the DLL.

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

I hope you didn't convert that to AutoIt by hand :idea:

Shouldn't CALLBACK and WINAPI be stdcall instead of cdecl?

Thank you ... You are right ... I modify the code :)

Remarks

By default, AutoIt uses the 'stdcall' calling method. To use the 'cdecl' method place ':cdecl' after the return type.

DllCall("SQLite.dll", "int:cdecl", "sqlite3_open", "str", $sDatabase_Filename , "long*", 0).

Edited by wolf9228

صرح السماء كان هنا

 

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

wolf9228,

You know that you can add more than one case to a line, if it's output is the same?

Example:

Case 'PCHAR', 'PCSTR', 'PCTSTR'
 Return "str"

@Kip, I think he converted by hand.

James

I wrote GeTType function by using the String functions

And File user defined functions Thanks! :idea:

Edited by wolf9228

صرح السماء كان هنا

 

Share this post


Link to post
Share on other sites

#8 ·  Posted

What about SMALL_RECT? http://msdn.microsoft.com/en-us/library/ms686125(VS.85).aspx

I'm guessing its just 'ptr'...

Yes, that's right ... Type of data in this case would be the Ptr :idea:


صرح السماء كان هنا

 

Share this post


Link to post
Share on other sites

#9 ·  Posted

There is bug

Case 'HCURSOR'
Return 'HICON'

it should be

Case 'HCURSOR'
Return 'HANDLE'

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

I liked the idea but a massive Switch..EndSwitch statement was a little too much for me, so I decided to convert this function into an Array instead. Of course I created some 'conversion' code to convert the switch statement into an Array and then pasted this into a small function.

Conversion Code:

#include <String.au3>

Example()

Func Example()
    Local $aMSDN = _StringBetween(FileRead('GetType.au3'), 'Case ', @CRLF)
    Local $aAutoIt = _StringBetween(FileRead('GetType.au3'), 'Return ', @CRLF)

    If UBound($aMSDN) = UBound($aAutoIt) Then
        Local $sString = 'Local $aType[' & (UBound($aMSDN) - 1) & '][2] = [[' & (UBound($aMSDN) - 2) & ', 2], '
        For $i = 1 To UBound($aMSDN) - 2 ; Skip 0th element and last'th element!
            $sString &= '[' & $aMSDN[$i] & ',' & $aAutoIt[$i] & '],'
            If (Not Mod($i, 5)) Then
                $sString &= '_' & @CRLF
                $sString &= @TAB & @TAB
            EndIf
        Next
        $sString = StringTrimRight(StringStripWS($sString, 3), 1) & ']'
        ClipPut($sString)
        Return MsgBox(4096, '', $sString)
    EndIf
    Return MsgBox(4096, '', 'An error occurred!')
EndFunc   ;==>Example

Function:

ConsoleWrite('MSDN: PTCHAR, AutoIt: ' & _MSDNDataType('PTCHAR') & @CRLF)

Func _MSDNDataType($sType) ; Idea by wolf9228, code by guinness.
    Local $aType[157][2] = [[156, 2],['ATOM', 'WORD'],['BOOL', 'BOOL'],['BOOLEAN', 'BOOLEAN'],['BYTE', 'BYTE'],['CHAR', 'str'], _
            ['COLORREF', 'DWORD'],['CONST', 'const'],['DWORD', 'DWORD'],['DWORDLONG', 'ULONG'],['DWORD_PTR', 'DWORD_PTR'], _
            ['DWORD32', 'UINT'],['DWORD64', 'INT64'],['FLOAT', 'FLOAT'],['HACCEL', 'HANDLE'],['HALF_PTR', 'ptr'], _
            ['HANDLE', 'HANDLE'],['HBITMAP', 'HANDLE'],['HBRUSH', 'HANDLE'],['HCONV', 'HANDLE'],['HCONVLIST', 'HANDLE'], _
            ['HCURSOR', 'HANDLE'],['HDC', 'HANDLE'],['HDDEDATA', 'HANDLE'],['HDESK', 'HANDLE'],['HDROP', 'HANDLE'], _
            ['HDWP', 'HANDLE'],['HENHMETAFILE', 'HANDLE'],['HFILE', 'int'],['HFONT', 'HANDLE'],['HGIDOBJ', 'HANDLE'], _
            ['HGLOBAL', 'HANDLE'],['HHOOK', 'HANDLE'],['HICON', 'HANDLE'],['HINSTANCE', 'HANDLE'],['HKEY', 'HANDLE'], _
            ['HKL', 'HANDLE'],['HLOCAL', 'HANDLE'],['HMENU', 'HANDLE'],['HMETAFILE', 'HANDLE'],['HMODULE', 'HANDLE'], _
            ['HMONITOR', 'HANDLE'],['HPALETTE', 'HANDLE'],['HPEN', 'HANDLE'],['HRESULT', 'LONG'],['HRGN', 'HANDLE'], _
            ['HRSRC', 'HANDLE'],['HSZ', 'HANDLE'],['HWINSTA', 'HANDLE'],['HWND', 'HWND'],['INT_PTR', 'INT_PTR'], _
            ['INT32', 'int'],['INT64', 'INT64'],['LANGID', 'WORD'],['LCID', 'DWORD'],['LGRPID', 'DWORD'], _
            ['LONG', 'LONG'],['LONGLONG', 'INT64'],['LONG_PTR', 'LONG_PTR'],['LONG32', 'int'],['LONG64', 'INT64'], _
            ['LPARAM', 'LPARAM'],['LPBOOL', 'int*'],['LPBYTE', 'int*'],['LPCOLORREF', 'DWORD*'],['LPCSTR', 'str'], _
            ['LPCTSTR', 'str'],['LPCWSTR', 'wstr'],['LPDWORD', 'DWORD*'],['LPHANDLE', 'HANDLE*'],['LPINT', 'int*'], _
            ['LPLONG', 'long*'],['LPSTR', 'str'],['LPTSTR', 'str'],['LPVOID', 'ptr'],['LPWORD', 'WORD*'], _
            ['LPWSTR', 'wstr'],['LRESULT', 'LRESULT'],['PBOOL', 'BOOL*'],['PBOOLEAN', 'BOOLEAN*'],['PBYTE', 'BYTE*'], _
            ['PCHAR', 'str'],['PCSTR', 'str'],['PCTSTR', 'str'],['PCWSTR', 'wstr'],['PDWORD', 'DWORD*'], _
            ['PDWORDLONG', 'UINT64'],['PDWORD_PTR', 'DWORD_PTR*'],['PDWORD32', 'UINT*'],['PDWORD64', 'INT64*'],['PFLOAT', 'FLOAT*'], _
            ['PHALF_PTR', 'ptr'],['PHANDLE', 'HANDLE*'],['PHKEY', 'HANDLE*'],['PINT', 'int*'],['PINT_PTR', 'INT_PTR*'], _
            ['PINT32', 'int*'],['PINT64', 'INT64*'],['PLCID', 'DWORD*'],['PLONG', 'LONG*'],['PLONGLONG', 'INT64*'], _
            ['PLONG_PTR', 'LONG_PTR*'],['PLONG32', 'long*'],['PLONG64', 'INT64*'],['POINTER_32', 'ptr'],['POINTER_64', 'ptr'], _
            ['POINTER_SIGNED', 'ptr'],['POINTER_UNSIGNED', 'ULONG_PTR'],['PSHORT', 'SHORT*'],['PSIZE_T', 'ULONG_PTR*'],['PSSIZE_T', 'LONG_PTR*'], _
            ['PSTR', 'str'],['PTBYTE', 'BYTE*'],['PTCHAR', 'wstr'],['PTSTR', 'wstr'],['PUCHAR', 'BYTE*'], _
            ['PUHALF_PTR', 'ptr*'],['PUINT', 'UINT*'],['PUINT_PTR', 'UINT_PTR*'],['PUINT32', 'UINT*'],['PUINT64', 'UINT64*'], _
            ['PULONG', 'ULONG*'],['PULONGLONG', 'UINT64*'],['PULONG_PTR', 'ULONG_PTR*'],['PULONG32', 'ULONG*'],['PULONG64', 'UINT64*'], _
            ['PUSHORT', 'USHORT*'],['PVOID', 'ptr'],['PWCHAR', 'wstr'],['PWORD', 'WORD*'],['PWSTR', 'wstr'], _
            ['SC_HANDLE', 'HANDLE'],['SC_LOCK', 'ptr'],['SERVICE_STATUS_HANDLE', 'HANDLE'],['SHORT', 'SHORT'],['SIZE_T', 'ULONG_PTR'], _
            ['SSIZE_T', 'LONG_PTR'],['TBYTE', 'wstr'],['TCHAR', 'wstr'],['UCHAR', 'BYTE'],['UHALF_PTR', 'ptr'], _
            ['UINT', 'UINT'],['UINT_PTR', 'UINT_PTR'],['UINT32', 'UINT'],['UINT64', 'UINT64'],['ULONG', 'ULONG'], _
            ['ULONGLONG', 'UINT64'],['ULONG_PTR', 'ULONG_PTR'],['ULONG32', 'ULONG'],['ULONG64', 'UINT64'],['UNICODE_STRING', 'ptr'], _
            ['USHORT', 'USHORT'],['USN', 'INT64'],['VOID', 'none'],['WCHAR', 'wstr'],['WORD', 'WORD'], _
            ['WPARAM', 'WPARAM']]

    If StringStripWS($sType, 8) <> '' Then
        For $i = 1 To $aType[0][0]
            If $sType = $aType[$i][0] Then
                Return $aType[$i][1]
            EndIf
        Next
    EndIf
    Return SetError(1, 0, '')
EndFunc   ;==>_MSDNDataType
Edited by guinness

UDF List:

 

_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

 

 

Updated: 02/04/2015

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0