This is a patch to implement Dnsapi.dll. It contains "bare bones".
This was done mainly to help with Bug 4323
<http://bugs.winehq.org/show_bug.cgi?id=4323>. This patch has the
DllMain entry point, a function and a stub, header files,
implementation into the tree, and a .spec file. Please tell me how to
correct anything if there is a problem.
Index: configure.ac
===================================================================
RCS file: /home/wine/wine/configure.ac,v
retrieving revision 1.448
diff -u -p -r1.448 configure.ac
--- configure.ac	24 Feb 2006 10:49:53 -0000	1.448
+++ configure.ac	27 Feb 2006 04:16:17 -0000
@@ -1193,6 +1193,7 @@ AC_CHECK_FUNCS(\
 	strcasecmp \
 	strerror \
 	strncasecmp \
+        strsep \
 	tcgetattr \
 	timegm \
 	usleep \
@@ -1495,6 +1496,7 @@ dlls/dmstyle/Makefile
 dlls/dmsynth/Makefile
 dlls/dmusic/Makefile
 dlls/dmusic32/Makefile
+dlls/dnsapi/Makefile
 dlls/dplay/Makefile
 dlls/dplayx/Makefile
 dlls/dpnet/Makefile
Index: dlls/Makefile.in
===================================================================
RCS file: /home/wine/wine/dlls/Makefile.in,v
retrieving revision 1.275
diff -u -p -r1.275 Makefile.in
--- dlls/Makefile.in	22 Feb 2006 21:31:58 -0000	1.275
+++ dlls/Makefile.in	27 Feb 2006 04:17:17 -0000
@@ -51,6 +51,7 @@ BASEDIRS = \
 	dmsynth \
 	dmusic \
 	dmusic32 \
+	dnsapi \
 	dplay \
 	dplayx \
 	dpnet \
@@ -297,6 +298,7 @@ SYMLINKS_SO = \
 	dmsynth.dll.so \
 	dmusic.dll.so \
 	dmusic32.dll.so \
+	dnsapi.dll.so \
 	dplay.dll.so \
 	dplayx.dll.so \
 	dpnet.dll.so \
@@ -573,6 +575,9 @@ dmusic.dll.so: dmusic/dmusic.dll.so
 dmusic32.dll.so: dmusic32/dmusic32.dll.so
 	$(RM) $@ && $(LN_S) dmusic32/dmusic32.dll.so $@
 
+dnsapi.dll.so: dnsapi/dnsapi.dll.so
+	$(RM) $@ && $(LN_S) dnsapi/dnsapi.dll.so $@
+
 dplay.dll.so: dplay/dplay.dll.so
 	$(RM) $@ && $(LN_S) dplay/dplay.dll.so $@
 
@@ -1118,6 +1123,7 @@ IMPORT_LIBS = \
 	dinput/libdinput.$(STATIC_IMPLIBEXT) \
 	dinput8/libdinput8.$(IMPLIBEXT) \
 	dmusic32/libdmusic32.$(IMPLIBEXT) \
+	dnsapi/libdnsapi.$(IMPLIBEXT) \
 	dplay/libdplay.$(IMPLIBEXT) \
 	dplayx/libdplayx.$(IMPLIBEXT) \
 	dpnet/libdpnet.$(IMPLIBEXT) \
@@ -1290,6 +1296,9 @@ dinput8/libdinput8.$(IMPLIBEXT): dinput8
 dmusic32/libdmusic32.$(IMPLIBEXT): dmusic32/dmusic32.spec $(WINEBUILD)
 	@cd dmusic32 && $(MAKE) libdmusic32.$(IMPLIBEXT)
 
+dnsapi/libdnsapi.$(IMPLIBEXT): dnsapi/dnsapi.spec $(WINEBUILD)
+	@cd dnsapi && $(MAKE) libdnsapi.$(IMPLIBEXT)
+
 dplay/libdplay.$(IMPLIBEXT): dplay/dplay.spec $(WINEBUILD)
 	@cd dplay && $(MAKE) libdplay.$(IMPLIBEXT)
 
@@ -1610,6 +1619,7 @@ dmstyle/dmstyle.dll.so: dmstyle
 dmsynth/dmsynth.dll.so: dmsynth
 dmusic/dmusic.dll.so: dmusic
 dmusic32/dmusic32.dll.so: dmusic32
+dnsapi/dnsapi.dll.so: dnsapi
 dplay/dplay.dll.so: dplay
 dplayx/dplayx.dll.so: dplayx
 dpnet/dpnet.dll.so: dpnet
--- /dev/null	2006-02-26 11:42:57.968674000 -0600
+++ include/windns.h	2006-02-26 22:11:27.000000000 -0600
@@ -0,0 +1,50 @@
+/*
+ * Windns.h Header file
+ *
+ * Copyright (C) 2006 Matthew Kehrer
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+#ifndef __WINE_DNS_H
+#define __WINE_DNS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Enumerations */
+
+typedef enum _DNS_NAME_FORMAT
+{
+    DnsNameDomain,
+    DnsDomainLabel,
+    DnsNameHostnameFull,
+    DnsHostnameLabel,
+    DnsNameWildcard,
+    DnsNameSrvRecord
+} DNS_NAME_FORMAT;
+
+/* Types */
+typedef long DNS_STATUS;
+
+/* Functions */
+BOOL WINAPI DnsNameCompare_A(LPSTR pName1, LPSTR pName2);
+DNS_STATUS WINAPI DnsValidateName_A(LPCSTR pszName, DNS_NAME_FORMAT);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
Common subdirectories: dlls/dnsapi and dlls/dnsapi/dnsapi
diff -Nu dlls/dnsapi.spec dlls/dnsapi/dnsapi.spec
--- dlls/dnsapi.spec	1969-12-31 18:00:00.000000000 -0600
+++ dlls/dnsapi/dnsapi.spec	2006-02-26 21:59:31.000000000 -0600
@@ -0,0 +1,162 @@
+# Generated from /mnt/windows/windows/system32/dnsapi.dll by winedump
+
+1 stub DnsGetDomainName
+2 stub DnsIsAMailboxType
+3 stub DnsIsStatusRcode
+4 stub DnsMapRcodeToStatus
+5 stub DnsStatusString
+6 stub DnsUnicodeToUtf8
+7 stub DnsUtf8ToUnicode
+8 stub Dns_ReadPacketName
+9 stub Dns_ReadPacketNameAllocate
+10 stub Dns_SkipPacketName
+11 stub Dns_WriteDottedNameToPacket
+12 stub BreakRecordsIntoBlob
+13 stub CombineRecordsInBlob
+14 stub DnsAcquireContextHandle_A
+15 stub DnsAcquireContextHandle_W
+16 stub DnsAddRecordSet_A
+17 stub DnsAddRecordSet_UTF8
+18 stub DnsAddRecordSet_W
+19 stub DnsAllocateRecord
+20 stub DnsApiAlloc
+21 stub DnsApiFree
+22 stub DnsApiHeapReset
+23 stub DnsApiRealloc
+24 stub DnsApiSetDebugGlobals
+25 stub DnsAsyncRegisterHostAddrs
+26 stub DnsAsyncRegisterInit
+27 stub DnsAsyncRegisterTerm
+28 stub DnsCopyStringEx
+29 stub DnsCreateReverseNameStringForIpAddress
+30 stub DnsCreateStandardDnsNameCopy
+31 stub DnsCreateStringCopy
+32 stub DnsDhcpSrvRegisterHostName
+33 stub DnsDhcpSrvRegisterInit
+34 stub DnsDhcpSrvRegisterInitialize
+35 stub DnsDhcpSrvRegisterTerm
+36 stub DnsDowncaseDnsNameLabel
+37 stub DnsExtractRecordsFromMessage_UTF8
+38 stub DnsExtractRecordsFromMessage_W
+39 stub DnsFindAuthoritativeZone
+40 stub DnsFlushResolverCache
+41 stub DnsFlushResolverCacheEntry_A
+42 stub DnsFlushResolverCacheEntry_UTF8
+43 stub DnsFlushResolverCacheEntry_W
+44 stub DnsFree
+45 stub DnsFreeConfigStructure
+46 stub DnsGetBufferLengthForStringCopy
+47 stub DnsGetCacheDataTable
+48 stub DnsGetDnsServerList
+49 stub DnsGetIpAddressInfoList
+50 stub DnsGetLastFailedUpdateInfo
+51 stub DnsGetLocalAddrArray
+52 stub DnsGetLocalAddrArrayDirect
+53 stub DnsGetPrimaryDomainName_A
+54 stub DnsGlobals
+55 stub DnsIpv6AddressToString
+56 stub DnsIpv6StringToAddress
+57 stub DnsIsStringCountValidForTextType
+58 stub DnsModifyRecordSet_A
+59 stub DnsModifyRecordSet_UTF8
+60 stub DnsModifyRecordSet_W
+61 stub DnsModifyRecordsInSet_A
+62 stub DnsModifyRecordsInSet_UTF8
+63 stub DnsModifyRecordsInSet_W
+64 stub DnsNameCompareEx_A
+65 stub DnsNameCompareEx_UTF8
+66 stub DnsNameCompareEx_W
+67 stdcall DnsNameCompare_A(str str)
+68 stub DnsNameCompare_UTF8
+69 stub DnsNameCompare_W
+70 stub DnsNameCopy
+71 stub DnsNameCopyAllocate
+72 stub DnsNotifyResolver
+73 stub DnsNotifyResolverClusterIp
+74 stub DnsNotifyResolverEx
+75 stub DnsQueryConfig
+76 stub DnsQueryConfigAllocEx
+77 stub DnsQueryConfigDword
+78 stub DnsQueryExA
+79 stub DnsQueryExUTF8
+80 stub DnsQueryExW
+81 stub DnsQuery_A
+82 stub DnsQuery_UTF8
+83 stub DnsQuery_W
+84 stub DnsRecordBuild_UTF8
+85 stub DnsRecordBuild_W
+86 stub DnsRecordCompare
+87 stub DnsRecordCopyEx
+88 stub DnsRecordListFree
+89 stub DnsRecordSetCompare
+90 stub DnsRecordSetCopyEx
+91 stub DnsRecordSetDetach
+92 stub DnsRecordStringForType
+93 stub DnsRecordStringForWritableType
+94 stub DnsRecordTypeForName
+95 stub DnsRegisterClusterAddress
+96 stub DnsReleaseContextHandle
+97 stub DnsRemoveRegistrations
+98 stub DnsReplaceRecordSetA
+99 stub DnsReplaceRecordSetUTF8
+100 stub DnsReplaceRecordSetW
+101 stub DnsSetConfigDword
+102 stub DnsStringCopyAllocateEx
+103 stub DnsUpdate
+104 stub DnsUpdateTest_A
+105 stub DnsUpdateTest_UTF8
+106 stub DnsUpdateTest_W
+107 stdcall DnsValidateName_A(str long)
+108 stub DnsValidateName_UTF8
+109 stub DnsValidateName_W
+110 stub DnsValidateUtf8Byte
+111 stub DnsWriteQuestionToBuffer_UTF8
+112 stub DnsWriteQuestionToBuffer_W
+113 stub DnsWriteReverseNameStringForIpAddress
+114 stub Dns_AddRecordsToMessage
+115 stub Dns_AllocateMsgBuf
+116 stub Dns_BuildPacket
+117 stub Dns_CacheSocketCleanup
+118 stub Dns_CacheSocketInit
+119 stub Dns_CleanupWinsock
+120 stub Dns_CloseConnection
+121 stub Dns_CloseHostFile
+122 stub Dns_CloseSocket
+123 stub Dns_CreateMulticastSocket
+124 stub Dns_CreateSocket
+125 stub Dns_CreateSocketEx
+126 stub Dns_FindAuthoritativeZoneLib
+127 stub Dns_GetIpAddresses
+128 stub Dns_GetLocalIpAddressArray
+129 stub Dns_GetRandomXid
+130 stub Dns_InitQueryTimeouts
+131 stub Dns_InitializeMsgRemoteSockaddr
+132 stub Dns_InitializeWinsock
+133 stub Dns_OpenHostFile
+134 stub Dns_OpenTcpConnectionAndSend
+135 stub Dns_ParseMessage
+136 stub Dns_ParsePacketRecord
+137 stub Dns_PingAdapterServers
+138 stub Dns_ReadHostFileLine
+139 stub Dns_ReadRecordStructureFromPacket
+140 stub Dns_RecvTcp
+141 stub Dns_ResetNetworkInfo
+142 stub Dns_SendAndRecvUdp
+143 stub Dns_SendEx
+144 stub Dns_SetRecordDatalength
+145 stub Dns_SkipToRecord
+146 stub Dns_UpdateLib
+147 stub Dns_UpdateLibEx
+148 stub Dns_WriteQuestionToMessage
+149 stub Dns_WriteRecordStructureToPacketEx
+150 stub GetCurrentTimeInSeconds
+151 stub GetRecordsForLocalName
+152 stub NetInfo_Build
+153 stub NetInfo_Clean
+154 stub NetInfo_Copy
+155 stub NetInfo_Free
+156 stub NetInfo_IsForUpdate
+157 stub NetInfo_ResetServerPriorities
+158 stub QueryDirectEx
+159 stub Query_Main
+160 stub Reg_ReadGlobalsEx
diff -Nu dlls/main.c dlls/dnsapi/main.c
--- dlls/main.c	1969-12-31 18:00:00.000000000 -0600
+++ dlls/dnsapi/main.c	2006-02-26 20:21:50.000000000 -0600
@@ -0,0 +1,50 @@
+/*
+ * Main file for dnsapi.dll 
+ *
+ * Copyright (C) 2006 Matthew Kehrer
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#include <stdarg.h>
+
+#include "windef.h"
+#include "winbase.h"
+#include "windns.h"
+#include "winerror.h"
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(dns);
+
+BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
+{
+    TRACE("(%p,%ld,%p)",hinstDLL,fdwReason,lpvReserved);
+
+	
+	
+	
+	
+    if(fdwReason == DLL_THREAD_ATTACH)
+    {
+        DisableThreadLibraryCalls(hinstDLL);
+        return TRUE;
+    }
+
+    if(fdwReason == DLL_PROCESS_DETACH)
+    {
+         FreeLibrary(hinstDLL);
+         return TRUE;
+    }
+    return TRUE;
+}
diff -Nu dlls/Makefile.in dlls/dnsapi/Makefile.in
--- dlls/Makefile.in	1969-12-31 18:00:00.000000000 -0600
+++ dlls/dnsapi/Makefile.in	2006-02-26 17:17:02.000000000 -0600
@@ -0,0 +1,16 @@
+TOPSRCDIR = @top_srcdir@
+TOPOBJDIR = ../..
+SRCDIR    = @srcdir@
+VPATH     = @srcdir@
+MODULE    = dnsapi.dll
+IMPORTLIB = libdnsapi.$(IMPLIBEXT)
+IMPORTS   = kernel32
+EXTRALIBS = -lc
+
+C_SRCS = \
+        main.c \
+        names.c
+
[EMAIL PROTECTED]@
+
+### Dependencies:
diff -Nu dlls/names.c dlls/dnsapi/names.c
--- dlls/names.c	1969-12-31 18:00:00.000000000 -0600
+++ dlls/dnsapi/names.c	2006-02-26 21:58:39.000000000 -0600
@@ -0,0 +1,76 @@
+/*
+ * dnsapi.dll Name-related functions 
+ *
+ * Copyright (C) 2006 Matthew Kehrer
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#include <stdarg.h>
+#include <string.h>
+
+#include "windef.h"
+#include "winbase.h"
+#include "winerror.h"
+
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(dns);
+
+BOOL WINAPI DnsNameCompare_A(LPSTR pName1, LPSTR pName2)
+{
+    TRACE("(%s %s)\n",pName1, pName2);
+
+    char *period = ".";	
+
+    char *dots1 = strstr(pName1,period++);
+    char *dots2 = strstr(pName2,period++);
+
+    char *name1 = NULL;
+    char *name2 = NULL;
+
+    int equal;
+
+    /* The Platform SDK documentation for this says that it ignores all periods. */
+    /* So there's gonna be no periods! */
+
+    if(dots1 && dots2)
+    {
+        strsep(&name1,dots1);
+        strsep(&name2,dots2);
+        pName1 = name1;
+        pName2 = name2;
+    }
+
+    equal = strcmp(pName1,pName2);
+
+    if(equal == 0)
+    {
+        return TRUE;
+    }
+
+    if(equal > 0 || equal < 0)
+    {
+        return FALSE;
+    }
+}
+
+DNS_STATUS WINAPI DnsValidateName_A(LPCSTR pszName,DNS_NAME_FORMAT Format)
+{
+    FIXME("(%s, %d): stub!\n",pszName,Format);
+
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    return ERROR_CALL_NOT_IMPLEMENTED;
+}


Reply via email to