some rpcrt4 stuff

Greg Turner gmturner007 at ameritech.net
Tue Oct 1 20:39:14 CDT 2002


CHANGELOG:

* dlls/rpcrt4/rpcrt4.spec: Greg Turner <gmturner007 at ameritech.net>
- flesh out some stubs.

-- 
gmt

"If ye love wealth better than liberty, the tranquility
of servitude better than the animating contest of freedom,
go home from us in peace. We ask not your counsels or your
arms. Crouch down and lick the hands, which feed you. May
your chains set lightly upon you, and may posterity forget
that ye were our countrymen." 

-Samuel Adams

Index: dlls/rpcrt4/rpcrt4.spec
===================================================================
RCS file: /home/wine/wine/dlls/rpcrt4/rpcrt4.spec,v
retrieving revision 1.18
diff -u -r1.18 rpcrt4.spec
--- dlls/rpcrt4/rpcrt4.spec     21 Jun 2002 19:15:49 -0000      1.18
+++ dlls/rpcrt4/rpcrt4.spec     2 Oct 2002 01:34:08 -0000
@@ -174,12 +174,12 @@
 @ stub UuidCompare
 @ stdcall UuidCreate(ptr) UuidCreate
 @ stdcall UuidCreateSequential(ptr) UuidCreateSequential # win 2000
-@ stub UuidCreateNil
-@ stub UuidEqual
+@ stdcall UuidCreateNil(ptr) UuidCreateNil
+@ stdcall UuidEqual(ptr ptr ptr) UuidEqual
 @ stdcall UuidFromStringA(ptr ptr) UuidFromStringA
 @ stdcall UuidFromStringW(ptr ptr) UuidFromStringW
 @ stdcall UuidHash(ptr ptr) UuidHash
-@ stub UuidIsNil
+@ stdcall UuidIsNil(ptr ptr) UuidIsNil
 @ stdcall UuidToStringA(ptr ptr) UuidToStringA
 @ stub UuidToStringW

Index: dlls/rpcrt4/rpcrt4_main.c
===================================================================
RCS file: /home/wine/wine/dlls/rpcrt4/rpcrt4_main.c,v
retrieving revision 1.27
diff -u -r1.27 rpcrt4_main.c
--- dlls/rpcrt4/rpcrt4_main.c   17 Aug 2002 00:43:17 -0000      1.27
+++ dlls/rpcrt4/rpcrt4_main.c   2 Oct 2002 01:34:08 -0000
@@ -92,6 +92,81 @@
 }

 /*************************************************************************
+ * UuidCreateNil [RPCRT4.@]
+ *
+ * PARAMS
+ *     UUID *Uuid [O] returns a nil UUID
+ *
+ * RETURNS
+ *     RPC_S_OK
+ */
+RPC_STATUS WINAPI UuidCreateNil(UUID *Uuid)
+{
+  ZeroMemory(Uuid, sizeof(UUID));
+  return RPC_S_OK;
+}
+
+/*************************************************************************
+ * UuidIsNil [RPCRT4.@]
+ *
+ * PARAMS
+ *     UUID *Uuid         [I] Uuid to compare
+ *     RPC_STATUS *Status [O] retuns RPC_S_OK
+ *
+ * RETURNS
+ *     TRUE/FALSE
+ */
+int WINAPI UuidIsNil(UUID *Uuid, RPC_STATUS *Status)
+{
+  char *c, *cmax;
+
+  *Status = RPC_S_OK;
+
+  TRACE("%s\n", debugstr_guid(Uuid));
+
+  cmax = (char *)Uuid + sizeof(UUID);
+  for (c=(char *)Uuid; c < cmax; c++)
+    if (*c != '\0')
+      return FALSE;
+
+  return TRUE;
+}
+
+/*************************************************************************
+ * UuidEqual [RPCRT4.@]
+ *
+ * PARAMS
+ *     UUID *Uuid1        [I] Uuid to compare
+ *     UUID *Uuid2        [I] Uuid to compare
+ *     RPC_STATUS *Status [O] returns RPC_S_OK
+ *
+ * RETURNS
+ *     TRUE/FALSE
+ */
+int WINAPI UuidEqual(UUID *Uuid1, UUID *Uuid2, RPC_STATUS *Status)
+{
+  RPC_STATUS stat;
+
+  *Status = RPC_S_OK;
+
+  TRACE("(%s,%s)\n", debugstr_guid(Uuid1), debugstr_guid(Uuid2));
+
+  if (Uuid1==Uuid2) return TRUE;
+
+  if (UuidIsNil(Uuid1, &stat) && (!Uuid2))
+    return TRUE;
+  if (UuidIsNil(Uuid2, &stat) && (!Uuid1))
+    return TRUE;
+  if (!Uuid1) return FALSE;
+  if (!Uuid2) return FALSE;
+
+  if (memcmp(Uuid1, Uuid2, sizeof(UUID)) == 0)
+    return TRUE;
+  else
+    return FALSE;
+}
+
+/*************************************************************************
  *           UuidCreate   [RPCRT4.@]
  *
  * Creates a 128bit UUID.
@@ -364,10 +439,58 @@

 /***********************************************************************
  *             UuidFromStringA (RPCRT4.@)
+ *
+ * Coverts a string to a UUID
+ *
+ * RETURNS
+ *
+ *   S_OK if successful.
+ *   RPC_S_INVALID_STRING_UUID if unsuccessful.
  */
-RPC_STATUS WINAPI UuidFromStringA(LPSTR str, UUID *uuid)
+RPC_STATUS WINAPI UuidFromStringA(LPSTR str, UUID *Uuid)
 {
-    FIXME("%s %p\n",debugstr_a(str),uuid);
+    BYTE *s = (BYTE *) str;
+    int   i;
+
+    TRACE("%s\n", str);
+
+    if ((!s) || (strlen(s) == 0))
+        s = "00000000-0000-0000-0000-000000000000";
+    else {  /* validate the UUID string */
+        if (strlen(s) != 36)
+            return RPC_S_INVALID_STRING_UUID;
+
+        if ((s[8]!='-') || (s[13]!='-') || (s[18]!='-') || (s[23]!='-'))
+            return RPC_S_INVALID_STRING_UUID;
+
+        for (i=1; i<35; i++) {
+            if ((i == 8)||(i == 13)||(i == 18)||(i == 23)) continue;
+            if (!(((s[i] >= '0') && (s[i] <= '9'))  ||
+                  ((s[i] >= 'a') && (s[i] <= 'f'))  ||
+                  ((s[i] >= 'A') && (s[i] <= 'F'))))
+                return RPC_S_INVALID_STRING_UUID;
+        }
+    }
+
+
+    UINT32 vals[10];
+
+    if (sscanf(str, "%08lx-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
+                 &(Uuid->Data1), &(vals[0]), &(vals[1]), &(vals[2]),
+                &(vals[3]), &(vals[4]), &(vals[5]), &(vals[6]),
+                &(vals[7]), &(vals[8]), &(vals[9])) == 11) {
+        Uuid->Data2 = vals[0];
+        Uuid->Data3 = vals[1];
+        Uuid->Data4[0] = vals[2];
+        Uuid->Data4[1] = vals[3];
+        Uuid->Data4[2] = vals[4];
+        Uuid->Data4[3] = vals[5];
+        Uuid->Data4[4] = vals[6];
+        Uuid->Data4[5] = vals[7];
+        Uuid->Data4[6] = vals[8];
+        Uuid->Data4[7] = vals[9];
+        return S_OK;
+    }
     return RPC_S_INVALID_STRING_UUID;
 }





More information about the wine-patches mailing list