WinAsm Studio, The Assembly IDE - Free Downloads, Source Code
Sponsors
Articles
Programming Quick Start
32-bit Assembler is Easy
Porting Iczelion tutorials
What is FASM
Hard Drive Recovery
Wiring your own LAN
Personal menu
Welcome Guest
User:
Pass:
Register!
Resend Validation Email
 
Forum
Pages (3) [1] 2 3   ( Go to first unread post )

How to use GetComputerName API, I am new to asm can anyone help how to use GetComputerName API in masm?

s.raj
Quote Post


Member
**

Group: Members
Posts: 34
Member No.: 48809
Joined: 7-January 12


Hi,

I am new to asm anyone help how to use GetComputerName API in masm?

Regards,
PM
Top
ragdog
Quote Post


Extremely Active Member
******

Group: Moderators
Posts: 874
Member No.: 5019
Joined: 13-May 07


Syntax

BOOL WINAPI GetComputerName(
__out LPTSTR lpBuffer,
__inout LPDWORD lpnSize
);

Parameters

lpBuffer [out]

A pointer to a buffer that receives the computer name or the cluster virtual server name. The buffer size should be large enough to contain MAX_COMPUTERNAME_LENGTH + 1 characters.
lpnSize [in, out]

On input, specifies the size of the buffer, in TCHARs. On output, the number of TCHARs copied to the destination buffer, not including the terminating null character.

If the buffer is too small, the function fails and GetLastError returns ERROR_BUFFER_OVERFLOW. The lpnSize parameter specifies the size of the buffer required, including the terminating null character.


http://msdn.microsoft.com/en-us/library/windows/desktop/ms724295%28v=vs.85%29.aspx
PMUsers Website
Top
winnet
Quote Post


Member
**

Group: Members
Posts: 20
Member No.: 41214
Joined: 18-January 11


CODE
.386
.model flat, stdcall
option casemap:none
include     \masm32\include\windows.inc
include     \masm32\include\kernel32.inc
include     \masm32\include\user32.inc

includelib  \masm32\lib\kernel32.lib
includelib  \masm32\lib\user32.lib




bufSize=MAX_COMPUTERNAME_LENGTH + 1
.data


format1     db 'Computer Name is = %s',0
capt        db 'Hello',0
buffer    db 100 dup(?)
bSize dd bufSize
getName db bufSize dup(?)


.code

start:

   invoke  GetComputerName,ADDR getName,ADDR bSize

   invoke  wsprintf,ADDR buffer,ADDR format1,ADDR getName
   invoke  MessageBox,0,ADDR buffer,ADDR capt,MB_OK


   invoke  ExitProcess,0

END start
PMEmail Poster
Top
s.raj
Quote Post


Member
**

Group: Members
Posts: 34
Member No.: 48809
Joined: 7-January 12


Thank you !
PM
Top
s.raj
Quote Post


Member
**

Group: Members
Posts: 34
Member No.: 48809
Joined: 7-January 12


For what wsprintf invoked? Thanks in advance!
PM
Top
0 User(s) are reading this topic (0 Guests and 0 Anonymous Users)
0 Members:

Topic Options Pages (3) [1] 2 3  Reply to this topicStart new topicStart Poll

 

Sponsors
Computer Science

Internet
C/C++
Hardware & PC maintenance

HiEditor

General Discussions
Suggestions/Bug Reports
WinAsm Studio

General Discussions
Suggestions/Bug Reports
WinAsm Studio FAQ
Multilingual User Interface
Add-Ins
Assembly Programming

Main
Newbies
Projects
Custom Controls
Snippets
Announcements & Rules

Announcements

General

Online Degrees - Distance Learning
The Heap
Russian
Google