Gamestudio Links
Zorro Links
Newest Posts
Z9 getting Error 058
by madpower2000. 07/22/26 10:56
ZorroGPT
by TipmyPip. 07/21/26 17:54
New Zorro version 3.11
by jcl. 07/21/26 13:42
Lapsa's very own thread
by Lapsa. 07/18/26 13:40
Purchase A8 full licence version
by ukgamer. 07/17/26 05:52
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
4 registered members (TipmyPip, madpower2000, VoroneTZ, 1 invisible), 1,591 guests, and 19 spiders.
Key: Admin, Global Mod, Mod
Newest Members
riggi89, shuhari, KD1990, Ephraim, Student_64151
19223 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
HOW to get the hardisk's serial number ? #376453
07/03/11 00:33
07/03/11 00:33
Joined: Dec 2008
Posts: 13
X
xielijun Offline OP
Newbie
xielijun  Offline OP
Newbie
X

Joined: Dec 2008
Posts: 13
hello! there
I want to get the hardisk's serial number ,then i use code like :
windows api declare :
long __stdcall GetVolumeInformationchar*,char*,long,long,long,long,char*,long);
#define PRAGMA_API GetVolumeInformation;kernel32!getVolumeInformationA


long getbackit()
{
STRING* VolName;
STRING* FsysName;
long Maxlen;
long Sysflag;
long yingpan;
long aa;
aa=GetVolumeInformation("c:\\",VolName,256,yingpan,Maxlen,Sysflag,FsysName,256);
wait(1);
return(yingpan);
}

But i found aa is always 0, that means GetVolumeInformation does not work at all ! why? thx!

Re: HOW to get the hardisk's serial number ? [Re: xielijun] #376480
07/03/11 10:54
07/03/11 10:54
Joined: Jun 2011
Posts: 133
N
nomis23uk Offline
Member
nomis23uk  Offline
Member
N

Joined: Jun 2011
Posts: 133
this would proberly be best in the lite-c programming forum.

mod please move.


A8 Pro
Windows 7 64bit
QuadCore i7, 6 gb ram, ATI 5970
Re: HOW to get the hardisk's serial number ? [Re: nomis23uk] #376482
07/03/11 11:48
07/03/11 11:48
Joined: Aug 2009
Posts: 1,438
Spain
painkiller Offline
Serious User
painkiller  Offline
Serious User

Joined: Aug 2009
Posts: 1,438
Spain
in Aum 73 there is a Copyprotect workshop which reads the serial of your had drive, maybe it help


3D Gamestudio A8 Pro
AMD FX 8350 4.00 Ghz
16GB RAM
Gigabyte GeForce GTX 960 4GB
Re: HOW to get the hardisk's serial number ? [Re: painkiller] #376485
07/03/11 12:02
07/03/11 12:02
Joined: Dec 2008
Posts: 1,218
Germany
Rackscha Offline
Serious User
Rackscha  Offline
Serious User

Joined: Dec 2008
Posts: 1,218
Germany
there is no reason to use WAIT inside this function o.O


MY Website with news of my projects:
(for example my current
Muliplayer Bomberman,
GenesisPrecompiler for LiteC
and TileMaster, an easy to use Tile editor)
Sparetime-Development

Re: HOW to get the hardisk's serial number ? [Re: Rackscha] #376487
07/03/11 12:10
07/03/11 12:10
Joined: Apr 2007
Posts: 3,751
Canada
WretchedSid Offline
Expert
WretchedSid  Offline
Expert

Joined: Apr 2007
Posts: 3,751
Canada
The signature doesn't match, the optional out parameter are all pointers, not longs. And where you pass STRING objects it actually expects char arrays.
http://msdn.microsoft.com/en-us/library/aa364993(v=vs.85).aspx


Shitlord by trade and passion. Graphics programmer at Laminar Research.
I write blog posts at feresignum.com
Re: HOW to get the hardisk's serial number ? [Re: WretchedSid] #376500
07/03/11 14:51
07/03/11 14:51
Joined: Jun 2011
Posts: 133
N
nomis23uk Offline
Member
nomis23uk  Offline
Member
N

Joined: Jun 2011
Posts: 133
seeing as some people can be lazy despite telling them where to look here is the complete code from the AUM.

Code:
#include <acknex.h>
#include <default.c>
#include <windows.h>

STRING* temp_str = "#50";
STRING* serial_str = "#10"; // this string stores the actual serial for the hard drive

var op_result; // this variable is set to zero if we can't get the serial of the hard drive
var filehandle;
var serial_low; // stores the LOWORD of serial_number
var serial_high; // stores the HIWORD of serial_number

DWORD serial_number; // this variable will store the serial number

char label_name[30]; // this string will store the label name of the current hard drive (not used in this demo)

FONT* arial_font = "Arial#36";

TEXT* serial_txt = // this text displays the serial of the hard drive on the screen
{
	layer = 15;
	pos_x = 10;
	pos_y = 20;
	font = arial_font;
	string (serial_str);
	flags = VISIBLE;
} 

function main()
{
	video_mode = 6; // create a program window of 640x480 pixels
	vec_set(screen_color, vector(55, 55, 55)); // make the background color dark
	// find more info about GetVolumeInformation() by looking it up in MSDN
	op_result = GetVolumeInformation(NULL, label_name, 30, &serial_number, NULL, NULL, NULL, 0);
	// label_name contains the name of the label for the current hard drive; use it as well if you want to
	// the operation has failed? Tell the user that something went wrong (don't tell him / her that you are using the hdd serial!)
	if (!op_result) 
	{
		str_cpy(temp_str, "Can't get the system information data. The operation has failed.");
	}
	else // the operation has succeeded
	{
		serial_high = ((WORD) (((DWORD) (serial_number) >> 16) & 0xFFFF)); // extract the HIWORD from serial_number
		serial_low = ((WORD) (serial_number));	// extract the LOWORD from serial_number
		str_cpy(serial_str, "Serial number: "); 
		str_for_num(temp_str, serial_high);
		str_cat(serial_str, temp_str);
		str_for_num(temp_str, serial_low);
		str_cat(serial_str, "-"); 
		str_cat(serial_str, temp_str); // display the serial number on the screen
		filehandle = file_open_write ("serial.txt"); // now create and open the file named serial.txt
		file_str_write (filehandle, serial_str); // write the serial number inside it - tell the user to email it to you
		file_close (filehandle); // close the file
		wait (-5); // display the serial number for a few seconds; it will be stored inside serial.txt anyway
		sys_exit(NULL); // now shut down the engine
	}
}




A8 Pro
Windows 7 64bit
QuadCore i7, 6 gb ram, ATI 5970

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1