Create rpcrt4.dll.
Implement UuidCreate (using existing code from CoCreateGuid). CoCreateGuid calls UuidCreate.
This commit is contained in:
parent
d4eefeba12
commit
10b1b23d40
|
@ -131,6 +131,7 @@ DLLS = \
|
|||
psapi \
|
||||
rasapi32 \
|
||||
riched32 \
|
||||
rpcrt4 \
|
||||
setupapi \
|
||||
setupx \
|
||||
shell32 \
|
||||
|
|
|
@ -6209,6 +6209,7 @@ dlls/opengl32/Makefile
|
|||
dlls/psapi/Makefile
|
||||
dlls/rasapi32/Makefile
|
||||
dlls/richedit/Makefile
|
||||
dlls/rpcrt4/Makefile
|
||||
dlls/setupapi/Makefile
|
||||
dlls/setupx/Makefile
|
||||
dlls/shell32/Makefile
|
||||
|
@ -6448,6 +6449,7 @@ dlls/opengl32/Makefile
|
|||
dlls/psapi/Makefile
|
||||
dlls/rasapi32/Makefile
|
||||
dlls/richedit/Makefile
|
||||
dlls/rpcrt4/Makefile
|
||||
dlls/setupapi/Makefile
|
||||
dlls/setupx/Makefile
|
||||
dlls/shell32/Makefile
|
||||
|
|
|
@ -1008,6 +1008,7 @@ dlls/opengl32/Makefile
|
|||
dlls/psapi/Makefile
|
||||
dlls/rasapi32/Makefile
|
||||
dlls/richedit/Makefile
|
||||
dlls/rpcrt4/Makefile
|
||||
dlls/setupapi/Makefile
|
||||
dlls/setupx/Makefile
|
||||
dlls/shell32/Makefile
|
||||
|
|
|
@ -43,6 +43,7 @@ DLLFILES = \
|
|||
psapi/libpsapi.@LIBEXT@ \
|
||||
rasapi32/librasapi32.@LIBEXT@ \
|
||||
richedit/libriched32.@LIBEXT@ \
|
||||
rpcrt4/librpcrt4.@LIBEXT@ \
|
||||
setupx/libsetupx.@LIBEXT@ \
|
||||
setupapi/libsetupapi.@LIBEXT@ \
|
||||
shell32/libshell32.@LIBEXT@ \
|
||||
|
@ -148,6 +149,7 @@ SUBDIRS = \
|
|||
psapi \
|
||||
rasapi32 \
|
||||
richedit \
|
||||
rpcrt4 \
|
||||
setupx \
|
||||
shell32 \
|
||||
shfolder \
|
||||
|
@ -299,6 +301,9 @@ librasapi32.@LIBEXT@ librasapi16.@LIBEXT@: rasapi32/librasapi32.@LIBEXT@
|
|||
libriched32.@LIBEXT@: richedit/libriched32.@LIBEXT@
|
||||
$(RM) $@ && $(LN_S) richedit/libriched32.@LIBEXT@ $@
|
||||
|
||||
librpcrt4.@LIBEXT@: rpcrt4/librpcrt4.@LIBEXT@
|
||||
$(RM) $@ && $(LN_S) rpcrt4/librpcrt4.@LIBEXT@ $@
|
||||
|
||||
libsetupapi.@LIBEXT@: setupapi/libsetupapi.@LIBEXT@
|
||||
$(RM) $@ && $(LN_S) setupapi/libsetupapi.@LIBEXT@ $@
|
||||
|
||||
|
@ -386,6 +391,7 @@ ddraw/libddraw.so: libx11drv.so
|
|||
dplayx/libdplayx.so: libole32.so
|
||||
dsound/libdsound.so: libwinmm.so
|
||||
msvideo/libmsvfw32.so: libwinmm.so
|
||||
ole32/libole32.so: librpcrt4.so
|
||||
oleaut32/liboleaut32.so: libole32.so libcomctl32.so
|
||||
olecli/libolecli32.so: libolesvr32.so libole32.so
|
||||
olepro32/libolepro32.so: liboleaut32.so libole32.so
|
||||
|
|
|
@ -5,6 +5,7 @@ VPATH = @srcdir@
|
|||
MODULE = ole32
|
||||
SOVERSION = 1.0
|
||||
ALTNAMES = ole2 ole2nls ole2conv ole2prox ole2thk storage compobj
|
||||
IMPORTS = rpcrt4
|
||||
|
||||
C_SRCS = \
|
||||
antimoniker.c \
|
||||
|
|
|
@ -9,31 +9,9 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/stat.h>
|
||||
#ifdef HAVE_SYS_FILE_H
|
||||
# include <sys/file.h>
|
||||
#endif
|
||||
#include <sys/ioctl.h>
|
||||
#ifdef HAVE_SYS_SOCKET_H
|
||||
# include <sys/socket.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_SOCKIO_H
|
||||
# include <sys/sockio.h>
|
||||
#endif
|
||||
#ifdef HAVE_NET_IF_H
|
||||
# include <net/if.h>
|
||||
#endif
|
||||
#ifdef HAVE_NETINET_IN_H
|
||||
# include <netinet/in.h>
|
||||
#endif
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include <assert.h>
|
||||
#include "windef.h"
|
||||
#include "wtypes.h"
|
||||
|
@ -48,6 +26,7 @@
|
|||
#include "heap.h"
|
||||
#include "ldt.h"
|
||||
#include "winreg.h"
|
||||
#include "rpc.h"
|
||||
|
||||
#include "wine/obj_base.h"
|
||||
#include "wine/obj_misc.h"
|
||||
|
@ -533,200 +512,11 @@ HRESULT WINAPI CLSIDFromString16(
|
|||
/******************************************************************************
|
||||
* CoCreateGuid[OLE32.6]
|
||||
*
|
||||
* Creates a 128bit GUID.
|
||||
* Implemented according the DCE specification for UUID generation.
|
||||
* Code is based upon uuid library in e2fsprogs by Theodore Ts'o.
|
||||
* Copyright (C) 1996, 1997 Theodore Ts'o.
|
||||
*
|
||||
* RETURNS
|
||||
*
|
||||
* S_OK if successful.
|
||||
*/
|
||||
HRESULT WINAPI CoCreateGuid(
|
||||
GUID *pguid /* [out] points to the GUID to initialize */
|
||||
) {
|
||||
static char has_init = 0;
|
||||
unsigned char a[6];
|
||||
static int adjustment = 0;
|
||||
static struct timeval last = {0, 0};
|
||||
static UINT16 clock_seq;
|
||||
struct timeval tv;
|
||||
unsigned long long clock_reg;
|
||||
UINT clock_high, clock_low;
|
||||
UINT16 temp_clock_seq, temp_clock_mid, temp_clock_hi_and_version;
|
||||
#ifdef HAVE_NET_IF_H
|
||||
int sd;
|
||||
struct ifreq ifr, *ifrp;
|
||||
struct ifconf ifc;
|
||||
char buf[1024];
|
||||
int n, i;
|
||||
#endif
|
||||
|
||||
/* Have we already tried to get the MAC address? */
|
||||
if (!has_init) {
|
||||
#ifdef HAVE_NET_IF_H
|
||||
/* BSD 4.4 defines the size of an ifreq to be
|
||||
* max(sizeof(ifreq), sizeof(ifreq.ifr_name)+ifreq.ifr_addr.sa_len
|
||||
* However, under earlier systems, sa_len isn't present, so
|
||||
* the size is just sizeof(struct ifreq)
|
||||
*/
|
||||
#ifdef HAVE_SA_LEN
|
||||
# ifndef max
|
||||
# define max(a,b) ((a) > (b) ? (a) : (b))
|
||||
# endif
|
||||
# define ifreq_size(i) max(sizeof(struct ifreq),\
|
||||
sizeof((i).ifr_name)+(i).ifr_addr.sa_len)
|
||||
# else
|
||||
# define ifreq_size(i) sizeof(struct ifreq)
|
||||
# endif /* HAVE_SA_LEN */
|
||||
|
||||
sd = socket(AF_INET, SOCK_DGRAM, IPPROTO_IP);
|
||||
if (sd < 0) {
|
||||
/* if we can't open a socket, just use random numbers */
|
||||
/* set the multicast bit to prevent conflicts with real cards */
|
||||
a[0] = (rand() & 0xff) | 0x80;
|
||||
a[1] = rand() & 0xff;
|
||||
a[2] = rand() & 0xff;
|
||||
a[3] = rand() & 0xff;
|
||||
a[4] = rand() & 0xff;
|
||||
a[5] = rand() & 0xff;
|
||||
} else {
|
||||
memset(buf, 0, sizeof(buf));
|
||||
ifc.ifc_len = sizeof(buf);
|
||||
ifc.ifc_buf = buf;
|
||||
/* get the ifconf interface */
|
||||
if (ioctl (sd, SIOCGIFCONF, (char *)&ifc) < 0) {
|
||||
close(sd);
|
||||
/* no ifconf, so just use random numbers */
|
||||
/* set the multicast bit to prevent conflicts with real cards */
|
||||
a[0] = (rand() & 0xff) | 0x80;
|
||||
a[1] = rand() & 0xff;
|
||||
a[2] = rand() & 0xff;
|
||||
a[3] = rand() & 0xff;
|
||||
a[4] = rand() & 0xff;
|
||||
a[5] = rand() & 0xff;
|
||||
} else {
|
||||
/* loop through the interfaces, looking for a valid one */
|
||||
n = ifc.ifc_len;
|
||||
for (i = 0; i < n; i+= ifreq_size(*ifr) ) {
|
||||
ifrp = (struct ifreq *)((char *) ifc.ifc_buf+i);
|
||||
strncpy(ifr.ifr_name, ifrp->ifr_name, IFNAMSIZ);
|
||||
/* try to get the address for this interface */
|
||||
# ifdef SIOCGIFHWADDR
|
||||
if (ioctl(sd, SIOCGIFHWADDR, &ifr) < 0)
|
||||
continue;
|
||||
memcpy(a, (unsigned char *)&ifr.ifr_hwaddr.sa_data, 6);
|
||||
# else
|
||||
# ifdef SIOCGENADDR
|
||||
if (ioctl(sd, SIOCGENADDR, &ifr) < 0)
|
||||
continue;
|
||||
memcpy(a, (unsigned char *) ifr.ifr_enaddr, 6);
|
||||
# else
|
||||
/* XXX we don't have a way of getting the hardware address */
|
||||
close(sd);
|
||||
a[0] = 0;
|
||||
break;
|
||||
# endif /* SIOCGENADDR */
|
||||
# endif /* SIOCGIFHWADDR */
|
||||
/* make sure it's not blank */
|
||||
if (!a[0] && !a[1] && !a[2] && !a[3] && !a[4] && !a[5])
|
||||
continue;
|
||||
|
||||
goto valid_address;
|
||||
}
|
||||
/* if we didn't find a valid address, make a random one */
|
||||
/* once again, set multicast bit to avoid conflicts */
|
||||
a[0] = (rand() & 0xff) | 0x80;
|
||||
a[1] = rand() & 0xff;
|
||||
a[2] = rand() & 0xff;
|
||||
a[3] = rand() & 0xff;
|
||||
a[4] = rand() & 0xff;
|
||||
a[5] = rand() & 0xff;
|
||||
|
||||
valid_address:
|
||||
close(sd);
|
||||
}
|
||||
}
|
||||
#else
|
||||
/* no networking info, so generate a random address */
|
||||
a[0] = (rand() & 0xff) | 0x80;
|
||||
a[1] = rand() & 0xff;
|
||||
a[2] = rand() & 0xff;
|
||||
a[3] = rand() & 0xff;
|
||||
a[4] = rand() & 0xff;
|
||||
a[5] = rand() & 0xff;
|
||||
#endif /* HAVE_NET_IF_H */
|
||||
has_init = 1;
|
||||
}
|
||||
|
||||
/* generate time element of GUID */
|
||||
|
||||
/* Assume that the gettimeofday() has microsecond granularity */
|
||||
#define MAX_ADJUSTMENT 10
|
||||
|
||||
try_again:
|
||||
gettimeofday(&tv, 0);
|
||||
if ((last.tv_sec == 0) && (last.tv_usec == 0)) {
|
||||
clock_seq = ((rand() & 0xff) << 8) + (rand() & 0xff);
|
||||
clock_seq &= 0x1FFF;
|
||||
last = tv;
|
||||
last.tv_sec--;
|
||||
}
|
||||
if ((tv.tv_sec < last.tv_sec) ||
|
||||
((tv.tv_sec == last.tv_sec) &&
|
||||
(tv.tv_usec < last.tv_usec))) {
|
||||
clock_seq = (clock_seq+1) & 0x1FFF;
|
||||
adjustment = 0;
|
||||
} else if ((tv.tv_sec == last.tv_sec) &&
|
||||
(tv.tv_usec == last.tv_usec)) {
|
||||
if (adjustment >= MAX_ADJUSTMENT)
|
||||
goto try_again;
|
||||
adjustment++;
|
||||
} else
|
||||
adjustment = 0;
|
||||
|
||||
clock_reg = tv.tv_usec*10 + adjustment;
|
||||
clock_reg += ((unsigned long long) tv.tv_sec)*10000000;
|
||||
clock_reg += (((unsigned long long) 0x01B21DD2) << 32) + 0x13814000;
|
||||
|
||||
clock_high = clock_reg >> 32;
|
||||
clock_low = clock_reg;
|
||||
temp_clock_seq = clock_seq | 0x8000;
|
||||
temp_clock_mid = (UINT16)clock_high;
|
||||
temp_clock_hi_and_version = (clock_high >> 16) | 0x1000;
|
||||
|
||||
/* pack the information into the GUID structure */
|
||||
|
||||
((unsigned char*)&pguid->Data1)[3] = (unsigned char)clock_low;
|
||||
clock_low >>= 8;
|
||||
((unsigned char*)&pguid->Data1)[2] = (unsigned char)clock_low;
|
||||
clock_low >>= 8;
|
||||
((unsigned char*)&pguid->Data1)[1] = (unsigned char)clock_low;
|
||||
clock_low >>= 8;
|
||||
((unsigned char*)&pguid->Data1)[0] = (unsigned char)clock_low;
|
||||
|
||||
((unsigned char*)&pguid->Data2)[1] = (unsigned char)temp_clock_mid;
|
||||
temp_clock_mid >>= 8;
|
||||
((unsigned char*)&pguid->Data2)[0] = (unsigned char)temp_clock_mid;
|
||||
|
||||
((unsigned char*)&pguid->Data3)[1] = (unsigned char)temp_clock_hi_and_version;
|
||||
temp_clock_hi_and_version >>= 8;
|
||||
((unsigned char*)&pguid->Data3)[0] = (unsigned char)temp_clock_hi_and_version;
|
||||
|
||||
((unsigned char*)pguid->Data4)[1] = (unsigned char)temp_clock_seq;
|
||||
temp_clock_seq >>= 8;
|
||||
((unsigned char*)pguid->Data4)[0] = (unsigned char)temp_clock_seq;
|
||||
|
||||
((unsigned char*)pguid->Data4)[2] = a[0];
|
||||
((unsigned char*)pguid->Data4)[3] = a[1];
|
||||
((unsigned char*)pguid->Data4)[4] = a[2];
|
||||
((unsigned char*)pguid->Data4)[5] = a[3];
|
||||
((unsigned char*)pguid->Data4)[6] = a[4];
|
||||
((unsigned char*)pguid->Data4)[7] = a[5];
|
||||
|
||||
TRACE("%p", pguid);
|
||||
|
||||
return S_OK;
|
||||
return UuidCreate(pguid);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
|
|
|
@ -42,7 +42,7 @@ HRESULT WINAPI OleDuplicateData(HANDLE hSrc, CLIPFORMAT cfFormat,
|
|||
HRESULT WINAPI WriteFmtUserTypeStg(
|
||||
LPSTORAGE pstg, CLIPFORMAT cf, LPOLESTR lpszUserType)
|
||||
{
|
||||
FIXME("(%p,%x,%p) stub!\n",pstg,cf,lpszUserType);
|
||||
FIXME("(%p,%x,%s) stub!\n",pstg,cf,debugstr_w(lpszUserType));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
name ole32
|
||||
type win32
|
||||
import rpcrt4
|
||||
|
||||
1 stub BindMoniker # stdcall (ptr long ptr ptr) return 0,ERR_NOTIMPLEMENTED
|
||||
2 stdcall CLSIDFromProgID(wstr ptr) CLSIDFromProgID
|
||||
|
@ -133,7 +134,7 @@ type win32
|
|||
130 stdcall OleTranslateAccelerator(ptr ptr ptr) OleTranslateAccelerator
|
||||
131 stdcall OleUninitialize() OleUninitialize
|
||||
132 stub OpenOrCreateStream
|
||||
133 stdcall ProgIDFromCLSID(wstr ptr) ProgIDFromCLSID
|
||||
133 stdcall ProgIDFromCLSID(ptr ptr) ProgIDFromCLSID
|
||||
134 stdcall ReadClassStg(ptr ptr) ReadClassStg
|
||||
135 stdcall ReadClassStm(ptr ptr) ReadClassStm
|
||||
136 stdcall ReadFmtUserTypeStg(ptr ptr ptr) ReadFmtUserTypeStg
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
Makefile
|
||||
librpcrt4.so.1.0
|
||||
rpcrt4.spec.c
|
|
@ -0,0 +1,13 @@
|
|||
TOPSRCDIR = @top_srcdir@
|
||||
TOPOBJDIR = ../..
|
||||
SRCDIR = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
MODULE = rpcrt4
|
||||
SOVERSION = 1.0
|
||||
|
||||
C_SRCS = \
|
||||
rpcrt4_main.c
|
||||
|
||||
@MAKE_DLL_RULES@
|
||||
|
||||
### Dependencies:
|
|
@ -0,0 +1,6 @@
|
|||
name rpcrt4
|
||||
type win32
|
||||
init RPCRT4_LibMain
|
||||
|
||||
|
||||
@ stdcall UuidCreate(ptr) UuidCreate
|
|
@ -0,0 +1,266 @@
|
|||
/*
|
||||
* RPCRT4
|
||||
*
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "windef.h"
|
||||
#include "winerror.h"
|
||||
#include "winbase.h"
|
||||
#include "rpc.h"
|
||||
|
||||
#include <time.h>
|
||||
#include <sys/time.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef HAVE_SYS_FILE_H
|
||||
# include <sys/file.h>
|
||||
#endif
|
||||
#include <sys/ioctl.h>
|
||||
#ifdef HAVE_SYS_SOCKET_H
|
||||
# include <sys/socket.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_SOCKIO_H
|
||||
# include <sys/sockio.h>
|
||||
#endif
|
||||
#ifdef HAVE_NET_IF_H
|
||||
# include <net/if.h>
|
||||
#endif
|
||||
#ifdef HAVE_NETINET_IN_H
|
||||
# include <netinet/in.h>
|
||||
#endif
|
||||
|
||||
#include "debugtools.h"
|
||||
|
||||
DEFAULT_DEBUG_CHANNEL(ole);
|
||||
|
||||
/***********************************************************************
|
||||
* RPCRT4_LibMain
|
||||
*
|
||||
* PARAMS
|
||||
* hinstDLL [I] handle to the 'dlls' instance
|
||||
* fdwReason [I]
|
||||
* lpvReserved [I] reserverd, must be NULL
|
||||
*
|
||||
* RETURNS
|
||||
* Success: TRUE
|
||||
* Failure: FALSE
|
||||
*/
|
||||
|
||||
static DWORD RPCRT4_dwProcessesAttached = 0;
|
||||
|
||||
BOOL WINAPI
|
||||
RPCRT4_LibMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
|
||||
{
|
||||
switch (fdwReason) {
|
||||
case DLL_PROCESS_ATTACH:
|
||||
RPCRT4_dwProcessesAttached++;
|
||||
break;
|
||||
|
||||
case DLL_PROCESS_DETACH:
|
||||
RPCRT4_dwProcessesAttached--;
|
||||
break;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
* UuidCreate [RPCRT4]
|
||||
*
|
||||
* Creates a 128bit UUID.
|
||||
* Implemented according the DCE specification for UUID generation.
|
||||
* Code is based upon uuid library in e2fsprogs by Theodore Ts'o.
|
||||
* Copyright (C) 1996, 1997 Theodore Ts'o.
|
||||
*
|
||||
* RETURNS
|
||||
*
|
||||
* S_OK if successful.
|
||||
*/
|
||||
RPC_STATUS RPC_ENTRY UuidCreate(UUID *Uuid)
|
||||
{
|
||||
static char has_init = 0;
|
||||
unsigned char a[6];
|
||||
static int adjustment = 0;
|
||||
static struct timeval last = {0, 0};
|
||||
static UINT16 clock_seq;
|
||||
struct timeval tv;
|
||||
unsigned long long clock_reg;
|
||||
UINT clock_high, clock_low;
|
||||
UINT16 temp_clock_seq, temp_clock_mid, temp_clock_hi_and_version;
|
||||
#ifdef HAVE_NET_IF_H
|
||||
int sd;
|
||||
struct ifreq ifr, *ifrp;
|
||||
struct ifconf ifc;
|
||||
char buf[1024];
|
||||
int n, i;
|
||||
#endif
|
||||
|
||||
/* Have we already tried to get the MAC address? */
|
||||
if (!has_init) {
|
||||
#ifdef HAVE_NET_IF_H
|
||||
/* BSD 4.4 defines the size of an ifreq to be
|
||||
* max(sizeof(ifreq), sizeof(ifreq.ifr_name)+ifreq.ifr_addr.sa_len
|
||||
* However, under earlier systems, sa_len isn't present, so
|
||||
* the size is just sizeof(struct ifreq)
|
||||
*/
|
||||
#ifdef HAVE_SA_LEN
|
||||
# ifndef max
|
||||
# define max(a,b) ((a) > (b) ? (a) : (b))
|
||||
# endif
|
||||
# define ifreq_size(i) max(sizeof(struct ifreq),\
|
||||
sizeof((i).ifr_name)+(i).ifr_addr.sa_len)
|
||||
# else
|
||||
# define ifreq_size(i) sizeof(struct ifreq)
|
||||
# endif /* HAVE_SA_LEN */
|
||||
|
||||
sd = socket(AF_INET, SOCK_DGRAM, IPPROTO_IP);
|
||||
if (sd < 0) {
|
||||
/* if we can't open a socket, just use random numbers */
|
||||
/* set the multicast bit to prevent conflicts with real cards */
|
||||
a[0] = (rand() & 0xff) | 0x80;
|
||||
a[1] = rand() & 0xff;
|
||||
a[2] = rand() & 0xff;
|
||||
a[3] = rand() & 0xff;
|
||||
a[4] = rand() & 0xff;
|
||||
a[5] = rand() & 0xff;
|
||||
} else {
|
||||
memset(buf, 0, sizeof(buf));
|
||||
ifc.ifc_len = sizeof(buf);
|
||||
ifc.ifc_buf = buf;
|
||||
/* get the ifconf interface */
|
||||
if (ioctl (sd, SIOCGIFCONF, (char *)&ifc) < 0) {
|
||||
close(sd);
|
||||
/* no ifconf, so just use random numbers */
|
||||
/* set the multicast bit to prevent conflicts with real cards */
|
||||
a[0] = (rand() & 0xff) | 0x80;
|
||||
a[1] = rand() & 0xff;
|
||||
a[2] = rand() & 0xff;
|
||||
a[3] = rand() & 0xff;
|
||||
a[4] = rand() & 0xff;
|
||||
a[5] = rand() & 0xff;
|
||||
} else {
|
||||
/* loop through the interfaces, looking for a valid one */
|
||||
n = ifc.ifc_len;
|
||||
for (i = 0; i < n; i+= ifreq_size(*ifr) ) {
|
||||
ifrp = (struct ifreq *)((char *) ifc.ifc_buf+i);
|
||||
strncpy(ifr.ifr_name, ifrp->ifr_name, IFNAMSIZ);
|
||||
/* try to get the address for this interface */
|
||||
# ifdef SIOCGIFHWADDR
|
||||
if (ioctl(sd, SIOCGIFHWADDR, &ifr) < 0)
|
||||
continue;
|
||||
memcpy(a, (unsigned char *)&ifr.ifr_hwaddr.sa_data, 6);
|
||||
# else
|
||||
# ifdef SIOCGENADDR
|
||||
if (ioctl(sd, SIOCGENADDR, &ifr) < 0)
|
||||
continue;
|
||||
memcpy(a, (unsigned char *) ifr.ifr_enaddr, 6);
|
||||
# else
|
||||
/* XXX we don't have a way of getting the hardware address */
|
||||
close(sd);
|
||||
a[0] = 0;
|
||||
break;
|
||||
# endif /* SIOCGENADDR */
|
||||
# endif /* SIOCGIFHWADDR */
|
||||
/* make sure it's not blank */
|
||||
if (!a[0] && !a[1] && !a[2] && !a[3] && !a[4] && !a[5])
|
||||
continue;
|
||||
|
||||
goto valid_address;
|
||||
}
|
||||
/* if we didn't find a valid address, make a random one */
|
||||
/* once again, set multicast bit to avoid conflicts */
|
||||
a[0] = (rand() & 0xff) | 0x80;
|
||||
a[1] = rand() & 0xff;
|
||||
a[2] = rand() & 0xff;
|
||||
a[3] = rand() & 0xff;
|
||||
a[4] = rand() & 0xff;
|
||||
a[5] = rand() & 0xff;
|
||||
|
||||
valid_address:
|
||||
close(sd);
|
||||
}
|
||||
}
|
||||
#else
|
||||
/* no networking info, so generate a random address */
|
||||
a[0] = (rand() & 0xff) | 0x80;
|
||||
a[1] = rand() & 0xff;
|
||||
a[2] = rand() & 0xff;
|
||||
a[3] = rand() & 0xff;
|
||||
a[4] = rand() & 0xff;
|
||||
a[5] = rand() & 0xff;
|
||||
#endif /* HAVE_NET_IF_H */
|
||||
has_init = 1;
|
||||
}
|
||||
|
||||
/* generate time element of GUID */
|
||||
|
||||
/* Assume that the gettimeofday() has microsecond granularity */
|
||||
#define MAX_ADJUSTMENT 10
|
||||
|
||||
try_again:
|
||||
gettimeofday(&tv, 0);
|
||||
if ((last.tv_sec == 0) && (last.tv_usec == 0)) {
|
||||
clock_seq = ((rand() & 0xff) << 8) + (rand() & 0xff);
|
||||
clock_seq &= 0x1FFF;
|
||||
last = tv;
|
||||
last.tv_sec--;
|
||||
}
|
||||
if ((tv.tv_sec < last.tv_sec) ||
|
||||
((tv.tv_sec == last.tv_sec) &&
|
||||
(tv.tv_usec < last.tv_usec))) {
|
||||
clock_seq = (clock_seq+1) & 0x1FFF;
|
||||
adjustment = 0;
|
||||
} else if ((tv.tv_sec == last.tv_sec) &&
|
||||
(tv.tv_usec == last.tv_usec)) {
|
||||
if (adjustment >= MAX_ADJUSTMENT)
|
||||
goto try_again;
|
||||
adjustment++;
|
||||
} else
|
||||
adjustment = 0;
|
||||
|
||||
clock_reg = tv.tv_usec*10 + adjustment;
|
||||
clock_reg += ((unsigned long long) tv.tv_sec)*10000000;
|
||||
clock_reg += (((unsigned long long) 0x01B21DD2) << 32) + 0x13814000;
|
||||
|
||||
clock_high = clock_reg >> 32;
|
||||
clock_low = clock_reg;
|
||||
temp_clock_seq = clock_seq | 0x8000;
|
||||
temp_clock_mid = (UINT16)clock_high;
|
||||
temp_clock_hi_and_version = (clock_high >> 16) | 0x1000;
|
||||
|
||||
/* pack the information into the GUID structure */
|
||||
|
||||
((unsigned char*)&Uuid->Data1)[3] = (unsigned char)clock_low;
|
||||
clock_low >>= 8;
|
||||
((unsigned char*)&Uuid->Data1)[2] = (unsigned char)clock_low;
|
||||
clock_low >>= 8;
|
||||
((unsigned char*)&Uuid->Data1)[1] = (unsigned char)clock_low;
|
||||
clock_low >>= 8;
|
||||
((unsigned char*)&Uuid->Data1)[0] = (unsigned char)clock_low;
|
||||
|
||||
((unsigned char*)&Uuid->Data2)[1] = (unsigned char)temp_clock_mid;
|
||||
temp_clock_mid >>= 8;
|
||||
((unsigned char*)&Uuid->Data2)[0] = (unsigned char)temp_clock_mid;
|
||||
|
||||
((unsigned char*)&Uuid->Data3)[1] = (unsigned char)temp_clock_hi_and_version;
|
||||
temp_clock_hi_and_version >>= 8;
|
||||
((unsigned char*)&Uuid->Data3)[0] = (unsigned char)temp_clock_hi_and_version;
|
||||
|
||||
((unsigned char*)Uuid->Data4)[1] = (unsigned char)temp_clock_seq;
|
||||
temp_clock_seq >>= 8;
|
||||
((unsigned char*)Uuid->Data4)[0] = (unsigned char)temp_clock_seq;
|
||||
|
||||
((unsigned char*)Uuid->Data4)[2] = a[0];
|
||||
((unsigned char*)Uuid->Data4)[3] = a[1];
|
||||
((unsigned char*)Uuid->Data4)[4] = a[2];
|
||||
((unsigned char*)Uuid->Data4)[5] = a[3];
|
||||
((unsigned char*)Uuid->Data4)[6] = a[4];
|
||||
((unsigned char*)Uuid->Data4)[7] = a[5];
|
||||
|
||||
TRACE("%s", debugstr_guid(Uuid));
|
||||
|
||||
return S_OK;
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
/**************************************
|
||||
* RPC interface
|
||||
*
|
||||
*/
|
||||
#ifndef __WINE_RPC_H
|
||||
#define __WINE_RPC_H
|
||||
|
||||
#include "windef.h"
|
||||
|
||||
#define RPC_ENTRY WINAPI
|
||||
typedef long RPC_STATUS;
|
||||
|
||||
/* FIXME: this line should be in rpcndr.h */
|
||||
typedef unsigned char byte;
|
||||
|
||||
/* FIXME: and the following group should be in rpcdce.h */
|
||||
typedef void* RPC_AUTH_IDENTITY_HANDLE;
|
||||
typedef void* RPC_AUTHZ_HANDLE;
|
||||
|
||||
#ifndef GUID_DEFINED
|
||||
#define GUID_DEFINED
|
||||
typedef struct _GUID
|
||||
{
|
||||
DWORD Data1;
|
||||
WORD Data2;
|
||||
WORD Data3;
|
||||
BYTE Data4[8];
|
||||
} GUID;
|
||||
#endif
|
||||
|
||||
typedef GUID *LPGUID;
|
||||
typedef GUID CLSID,*LPCLSID;
|
||||
typedef GUID IID,*LPIID;
|
||||
typedef GUID FMTID,*LPFMTID;
|
||||
|
||||
#ifndef UUID_DEFINED
|
||||
#define UUID_DEFINED
|
||||
typedef GUID UUID;
|
||||
#endif
|
||||
|
||||
RPC_STATUS RPC_ENTRY UuidCreate(UUID *Uuid);
|
||||
|
||||
#endif /*__WINE_RPC_H */
|
|
@ -7,13 +7,7 @@
|
|||
|
||||
|
||||
#include "windef.h"
|
||||
|
||||
/* FIXME: this line should be in rpcndr.h */
|
||||
typedef unsigned char byte;
|
||||
|
||||
/* FIXME: and the following group should be in rpcdce.h */
|
||||
typedef void* RPC_AUTH_IDENTITY_HANDLE;
|
||||
typedef void* RPC_AUTHZ_HANDLE;
|
||||
#include "rpc.h"
|
||||
|
||||
|
||||
typedef WORD CLIPFORMAT, *LPCLIPFORMAT;
|
||||
|
@ -36,21 +30,6 @@ typedef BSTR *LPBSTR;
|
|||
#define OLESTR16(x) x
|
||||
#define OLESTR(x) L##x
|
||||
|
||||
#ifndef GUID_DEFINED
|
||||
#define GUID_DEFINED
|
||||
typedef struct _GUID
|
||||
{
|
||||
DWORD Data1;
|
||||
WORD Data2;
|
||||
WORD Data3;
|
||||
BYTE Data4[8];
|
||||
} GUID;
|
||||
#endif
|
||||
|
||||
typedef GUID *LPGUID;
|
||||
typedef GUID CLSID,*LPCLSID;
|
||||
typedef GUID IID,*LPIID;
|
||||
typedef GUID FMTID,*LPFMTID;
|
||||
#if defined(__cplusplus) && !defined(CINTERFACE)
|
||||
#define REFGUID const GUID &
|
||||
#define REFCLSID const CLSID &
|
||||
|
|
|
@ -63,6 +63,7 @@ static struct tagDllOverride {
|
|||
{"odbc32", "builtin"},
|
||||
{"opengl32", "builtin,native"},
|
||||
{"shfolder", "builtin,native"},
|
||||
{"rpcrt4", "native,builtin"},
|
||||
{NULL,NULL},
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue