Generateur de guid (win32)

Description

Un générateur de GUID un peu sur le principe de celui fourni avec VS.
Celui-ci par contre ne se sert pas de CoCreateGuid() ni aucun autre appel COM.
void __stdcall OnNewGuid(HWND hdlg)
{
BNGUID gd;
char buf[72], *c;

RemplirGuid(&gd); // REMPLIT LES 128 BITS DU GUID

// FORMAT: static const GUID <name> =
  • ((DWORD*) buf) = 0x78307B; // "{0x"

c = bndwtohexa(gd.dwa, buf + 3);
  • c++ = ','; *c++ = '0'; *c++ = 'x';

c = bndwtohexa(gd.wb, c);
  • c++ = ','; *c++ = '0'; *c++ = 'x';

c = bndwtohexa(gd.wc, c);
  • c++ = ','; *c++ = '{'; *c++ = '0'; *c++ = 'x';

c = bndwtohexa(gd.bd, c);
  • c++ = ','; *c++ = '0'; *c++ = 'x';

c = bndwtohexa(gd.be, c);
  • c++ = ','; *c++ = '0'; *c++ = 'x';

c = bndwtohexa(gd.bf, c);
  • c++ = ','; *c++ = '0'; *c++ = 'x';

c = bndwtohexa(gd.bg, c);
  • c++ = ','; *c++ = '0'; *c++ = 'x';

c = bndwtohexa(gd.bh, c);
  • c++ = ','; *c++ = '0'; *c++ = 'x';

c = bndwtohexa(gd.bi, c);
  • c++ = ','; *c++ = '0'; *c++ = 'x';

c = bndwtohexa(gd.bj, c);
  • c++ = ','; *c++ = '0'; *c++ = 'x';

c = bndwtohexa(gd.bk, c);
  • c = '}'; *(c+1) = '}'; *(c+2) = 0;

SetDlgItemText(hdlg, IDED_CONST, buf);

// FORMAT BASE DE REGISTRES:
buf[0] = '{';
c = bndwhex(gd.dwa, buf + 1);
  • c++ = '-';

c = bnwhex(gd.wb, c);
  • c++ = '-';

c = bnwhex(gd.wc, c);
  • c++ = '-';

c = bnbhex(gd.bd, c);
c = bnbhex(gd.be, c);
  • c++ = '-';

c = bnbhex(gd.bf, c);
c = bnbhex(gd.bg, c);
c = bnbhex(gd.bh, c);
c = bnbhex(gd.bi, c);
c = bnbhex(gd.bj, c);
c = bnbhex(gd.bk, c);
  • c = '}'; *(c+1) = 0;

SetDlgItemText(hdlg, IDED_REG, buf);
}

C'est du "prêt-à-porter", on utilise le prog tel quel sinon importer les funcs dans son code pour faire du GUID à l'exécution.
Tout est en ASM, regarde qui veut mais pas la peine d'hurler svp.
Renommer fichier toc du dossier release en exe pour utiliser.

Codes Sources

A voir également

Vous n'êtes pas encore membre ?

inscrivez-vous, c'est gratuit et ça prend moins d'une minute !

Les membres obtiennent plus de réponses que les utilisateurs anonymes.

Le fait d'être membre vous permet d'avoir un suivi détaillé de vos demandes et codes sources.

Le fait d'être membre vous permet d'avoir des options supplémentaires.