Powerbuilder pour les completement Geeks !

Le forum (ô combien francophone) des utilisateurs de Powerbuilder.

Recherche rapide

Annonce

Certaines rubriques, dont des cours, sont uniquement visibles par les membres du forum ^^.
Dans la rubrique Liens & Références, vous avez accès à un sommaire de téléchargement, profitez-en !
Il existe maintenant un nouveau TOPIC "Votre CV en Ligne" accessible uniquement par demande.

#26 13-07-2007 09:02:48

pick ouic  
La bourse ou la vie ^^
Award: gearotter
Lieu: Massy-Verrières
Date d'inscription: 29-05-2006
Messages: 4658
Pépites: 942
Banque: 2,147,483,647
Site web

Re: [RESOLU] Recuperation d'informations systemes

recuperation du nom de domaine... à tester

Code: pb

Function ulong NetGetDCName( &
  char servername[], &
  char domainname[], &
  ref ulong bufptr &
  ) Library "netapi32.dll" Alias for "NetGetDCName"



creer ensuite 2 fonctions.

of_string_to_unicode (string as_string, ref character ac_unicode[]);// convert string to unicode char array

Code: pb

Integer li_loop, li_len, li_uni

li_len = Len(as_string)

FOR li_loop = 1 TO li_len
  li_uni = li_uni + 1
  ac_unicode[li_uni] = Mid(as_string, li_loop, 1)
  li_uni = li_uni + 1
  ac_unicode[li_uni] = Char(0)
NEXT

li_uni = li_uni + 1
ac_unicode[li_uni] = Char(0)
li_uni = li_uni + 1
ac_unicode[li_uni] = Char(0)



function string of_unicode_to_string (unsignedlong aul_ptr);// get a string from a pointer to a unicode string

Code: pb

Char lc_byte
Integer li_loop
String ls_string

lc_byte = String(aul_ptr, "address")
DO WHILE Asc(lc_byte) > 0
  ls_string += String(lc_byte)
  li_loop = li_loop + 2
  lc_byte = String(aul_ptr + li_loop, "address")
LOOP

Return ls_string



on lance le script...

Code: pb

String ls_dcname, ls_msg
ULong lul_result, lul_bufptr
Char lc_server[], lc_domain[]

// convert arguments to unicode
of_string_to_unicode("", lc_server)
of_string_to_unicode("", lc_domain)

// call function to get DC name
lul_result = NetGetDCName(lc_server, lc_domain, lul_bufptr)

If lul_result = 0 Then
  // get string from buffer
  ls_dcname = of_unicode_to_string(lul_bufptr)
  // free buffer
End If

messagebox ("Nom de domaine",ls_dcname)

Connaitre son ignorance est une grande part de la connaissance.
http://animegifs.free.fr/anime/mazinger/mazinger.gif

Hors ligne

 

Pied de page des forums

Propulsé par FluxBB 1.2.22