News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

EQUs for COMPUTER_NAME_FORMAT enumeration ?

Started by Slugsnack, July 05, 2009, 02:19:14 AM

Previous topic - Next topic

Slugsnack

Does anyone know their values ? Namely :

- ComputerNameNetBIOS
- ComputerNameDnsHostname
- ComputerNameDnsDomain
- ComputerNameDnsFullyQualified
- ComputerNamePhysicalNetBIOS
- ComputerNamePhysicalDnsHostname
- ComputerNamePhysicalDnsDomain
- ComputerNamePhysicalDnsFullyQualified

I checked 2 of them and can't seem to find them in any of the include files in MASM32 folder, does anyone know where else I might find them ?

MichaelW

The values are from an enumeration defined in WinBase.h, with the values starting at the default of zero.

typedef enum _COMPUTER_NAME_FORMAT {
    ComputerNameNetBIOS,
    ComputerNameDnsHostname,
    ComputerNameDnsDomain,
    ComputerNameDnsFullyQualified,
    ComputerNamePhysicalNetBIOS,
    ComputerNamePhysicalDnsHostname,
    ComputerNamePhysicalDnsDomain,
    ComputerNamePhysicalDnsFullyQualified,
    ComputerNameMax
} COMPUTER_NAME_FORMAT ;

int main()
{
  printf( "%d\n", ComputerNameNetBIOS );
  printf( "%d\n", ComputerNameDnsHostname );
  printf( "%d\n", ComputerNameDnsDomain );
  printf( "%d\n", ComputerNameDnsFullyQualified );
  printf( "%d\n", ComputerNamePhysicalNetBIOS );
  printf( "%d\n", ComputerNamePhysicalDnsHostname );
  printf( "%d\n", ComputerNamePhysicalDnsDomain );
  printf( "%d\n", ComputerNamePhysicalDnsFullyQualified );
  printf( "%d\n", ComputerNameMax );

  getch();
  return 0;
}


0
1
2
3
4
5
6
7
8

eschew obfuscation

ToutEnMasm


They are describe in winbase.h .sdk
http://www.masm32.com/board/index.php?topic=11531.msg86280#msg86280

Quote
IF COMPARE(_WIN32_WINNT,GE,00500h)

;COMPUTER_NAME_FORMAT   UNION
   ComputerNameNetBIOS   EQU 0H
   ComputerNameDnsHostname   EQU 01H
   ComputerNameDnsDomain   EQU 02H
   ComputerNameDnsFullyQualified   EQU 03H
   ComputerNamePhysicalNetBIOS   EQU 04H
   ComputerNamePhysicalDnsHostname   EQU 05H
   ComputerNamePhysicalDnsDomain   EQU 06H
   ComputerNamePhysicalDnsFullyQualified   EQU 07H
   ComputerNameMax   EQU 08H
;COMPUTER_NAME_FORMAT      ENDS


Slugsnack

I seem not to have winbase.h in my MASM32 folder ? I tried to include that file from my dev-cpp folder but lots of errors.

It works okay when I manually do EQUs like the code Michael posted though.

Also just wanna check.. am I correctly waiting for the mouse updating thread to end in my code ?!

include \masm32\include\masm32rt.inc

DialogProc proto :DWORD, :DWORD, :DWORD, :DWORD
UpdateMouse proto

.data

bDialog DWORD 1
nSize DWORD MAX_COMPUTERNAME_LENGTH + 1
nUnknownSize DWORD 0

.data?

hSTCMouseX DWORD ?
hSTCMouseY DWORD ?

dwThreadId DWORD ?

hMem DWORD ?

szComputerName BYTE MAX_COMPUTERNAME_LENGTH + 1 DUP (?)

.const

ComputerNameNetBIOS    EQU 0H
ComputerNameDnsHostname    EQU 01H
ComputerNameDnsDomain    EQU 02H
ComputerNameDnsFullyQualified    EQU 03H
ComputerNamePhysicalNetBIOS    EQU 04H
ComputerNamePhysicalDnsHostname    EQU 05H
ComputerNamePhysicalDnsDomain    EQU 06H
ComputerNamePhysicalDnsFullyQualified   EQU 07H
ComputerNameMax EQU 08H

IDD_DLG1 EQU 1000
IDC_GRP1 EQU 1001
IDC_GRP2 EQU 1002
IDC_GRP3 EQU 1003
IDC_STC1 EQU 1004
IDC_STC2 EQU 1005
IDC_STC3 EQU 1006
IDC_STC4 EQU 1007
IDC_STC5 EQU 1008
IDC_STC6 EQU 1009
IDC_STC7 EQU 1010
IDC_STC8 EQU 1011
IDR_MENU1 EQU 10000
ID_OPTION1_EXPAND1 EQU 100000
ID_FILE_EXIT EQU 100001

.code
Start:

xor ebx, ebx
invoke GetModuleHandle, ebx
invoke DialogBoxParam, eax, IDD_DLG1, ebx, addr DialogProc, ebx
mov bDialog, 0

invoke WaitForSingleObject, dwThreadId, INFINITE
invoke ExitProcess, ebx

UpdateMouse proc
LOCAL pt:POINT

.WHILE bDialog == 1

invoke GetCursorPos, addr pt
invoke SetWindowText, hSTCMouseX, ustr$(pt.x)
invoke SetWindowText, hSTCMouseY, ustr$(pt.y)
invoke Sleep, 10

.ENDW

ret
UpdateMouse endp

DialogProc proc hwndDlg:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM

.IF uMsg == WM_INITDIALOG

invoke GetDlgItem, hwndDlg, IDC_STC3
mov hSTCMouseX, eax

invoke GetDlgItem, hwndDlg, IDC_STC4
mov hSTCMouseY, eax

invoke CreateThread, NULL, NULL, addr UpdateMouse, NULL, NULL, addr dwThreadId

invoke GetComputerName, addr szComputerName, addr nSize
invoke GetDlgItem, hwndDlg, IDC_STC6
invoke SetWindowText, eax, addr szComputerName

invoke GetComputerNameEx, ComputerNamePhysicalDnsFullyQualified, NULL, addr nUnknownSize
mov hMem, alloc(nUnknownSize)

invoke GetComputerNameEx, ComputerNamePhysicalDnsFullyQualified, hMem, addr nUnknownSize
invoke GetDlgItem, hwndDlg, IDC_STC8
invoke SetWindowText, eax, hMem

free hMem

.ELSEIF uMsg == WM_COMMAND

mov eax, wParam

.IF ax == ID_FILE_EXIT

invoke SendMessage, hwndDlg, WM_CLOSE, NULL, NULL

.ENDIF

.ELSEIF uMsg == WM_CLOSE

invoke EndDialog, hwndDlg, NULL

.ELSE

mov eax, FALSE
ret

.ENDIF

mov eax, TRUE

ret
DialogProc endp

end Start


also getcomputernameex just produces the same result ( same as getcomputername ) for every member of that enum that i call it for ?!

ToutEnMasm


You can only add translated .h in your source code.The link i provided in my upper post give translated headers.
The GetComputerNameEx function do the same than GetComputerName.
it's normal,search for the difference on msdn,it will be just for another computer or something like that.

Slugsnack

ohhh okay perfect, thanks : )

any comments on my multi-threading technique ?

ToutEnMasm

Is it very useful to use a thread ?
Update of the mouse moves can be done with windows messages like WM_MOUSEMOVE (or something like that).
There is a sample of mine somewhere in the forum.
http://www.masm32.com/board/index.php?topic=10700.msg78352#msg78352