PB Function that generate UUID
Long ll_rc
sr_uuid lstr_uuid
string ls_guid = ""
constant long RPC_S_OK = 0
constant long RPC_S_UUID_LOCAL_ONLY = 1824
constant long RPC_S_UUID_NO_ADDRESS = 1739
ll_rc = uuidCreate(lstr_uuid)
// returns
// RPC_S_OK - The call succeeded.
// RPC_S_UUID_LOCAL_ONLY -
// The UUID is guaranteed to be unique to this computer only.
// RPC_S_UUID_NO_ADDRESS -
// Cannot get Ethernet/token-ring hardware address for this computer.
IF ll_rc <> RPC_S_OK THEN
setNull(ls_GUID)
ELSE
If as_type = 'F' Then
ls_GUID = right("00000000" + of_tohex(lstr_uuid.data1), 8)
ls_GUID += "-" + right("0000" + of_tohex(lstr_uuid.data2), 4)
ls_GUID += "-" + right("0000" + of_tohex(lstr_uuid.data3), 4)
ls_GUID += "-" + right("0000" + of_tohex(lstr_uuid.data4[1]), 4)
ls_GUID += "-" + right("0000" + of_tohex(lstr_uuid.data4[2]), 4) &
+ right("0000" + of_tohex(lstr_uuid.data4[3]), 4) &
+ right("0000" + of_tohex(lstr_uuid.data4[4]), 4)
ls_GUID = upper(ls_GUID)
// output example : 00003B93-2641-477A-C99E-A2FFEBEB214A
Elseif as_type = 'R' Then
ls_GUID = right("00000000" + of_tohex(lstr_uuid.data1), 8)
ls_GUID += right("0000" + of_tohex(lstr_uuid.data2), 4)
ls_GUID += right("0000" + of_tohex(lstr_uuid.data3), 4)
ls_GUID += right("0000" + of_tohex(lstr_uuid.data4[1]), 4)
ls_GUID += right("0000" + of_tohex(lstr_uuid.data4[2]), 4) &
+ right("0000" + of_tohex(lstr_uuid.data4[3]), 4) &
+ right("0000" + of_tohex(lstr_uuid.data4[4]), 4)
ls_GUID = upper(ls_GUID)
// output example : 00003B932641477AC99EA2FFEBEB214A
End If
End If
Return ls_guid
Need to declare this external function
FUNCTION long uuidCreate(ref sr_uuid astr_uuid) LIBRARY "Rpcrt4.dll" ALIAS FOR "UuidCreate"
of_generate_uuid('R') or of_generate('F')
I need to ask you a question which I couldn't solve.
What is the definition of the structure that you have to pass a referencie en the function declared as sr_uuid.
Thxs
----------------------
unsignedlong data1
unsignedinteger data2
unsignedinteger data3
unsignedinteger data4[4]