[DHCPCSVC] Remove the now obsolete function DhcpRosGetAdapterInfo

This commit is contained in:
Eric Kohl 2025-04-19 11:42:09 +02:00
parent 3fe4b41f20
commit 2fe3073697
5 changed files with 0 additions and 117 deletions

View file

@ -205,40 +205,3 @@ DWORD DSStaticRefreshParams( PipeSendFunc Send, HANDLE CommPipe, COMM_DHCP_REQ *
return Send(CommPipe, &Reply );
}
DWORD DSGetAdapterInfo( PipeSendFunc Send, HANDLE CommPipe, COMM_DHCP_REQ *Req ) {
COMM_DHCP_REPLY Reply;
PDHCP_ADAPTER Adapter;
ApiLock();
Adapter = AdapterFindIndex( Req->AdapterIndex );
Reply.Reply = Adapter ? 1 : 0;
if( Adapter ) {
Reply.GetAdapterInfo.DhcpEnabled = (S_STATIC != Adapter->DhclientState.state);
if (S_BOUND == Adapter->DhclientState.state) {
if (sizeof(Reply.GetAdapterInfo.DhcpServer) ==
Adapter->DhclientState.active->serveraddress.len) {
memcpy(&Reply.GetAdapterInfo.DhcpServer,
Adapter->DhclientState.active->serveraddress.iabuf,
Adapter->DhclientState.active->serveraddress.len);
} else {
DPRINT1("Unexpected server address len %d\n",
Adapter->DhclientState.active->serveraddress.len);
Reply.GetAdapterInfo.DhcpServer = htonl(INADDR_NONE);
}
Reply.GetAdapterInfo.LeaseObtained = Adapter->DhclientState.active->obtained;
Reply.GetAdapterInfo.LeaseExpires = Adapter->DhclientState.active->expiry;
} else {
Reply.GetAdapterInfo.DhcpServer = htonl(INADDR_NONE);
Reply.GetAdapterInfo.LeaseObtained = 0;
Reply.GetAdapterInfo.LeaseExpires = 0;
}
}
ApiUnlock();
return Send(CommPipe, &Reply );
}

View file

@ -399,10 +399,6 @@ DWORD WINAPI PipeThreadProc( LPVOID Parameter ) {
DSStaticRefreshParams( PipeSend, CommPipe, &Req );
break;
case DhcpReqGetAdapterInfo:
DSGetAdapterInfo( PipeSend, CommPipe, &Req );
break;
default:
DPRINT1("Unrecognized request type %d\n", Req.Type);
ZeroMemory( &Reply, sizeof( COMM_DHCP_REPLY ) );

View file

@ -272,74 +272,6 @@ DhcpRequestParams(DWORD Flags,
return 0;
}
/*!
* Get DHCP info for an adapter
*
* \param[in] AdapterIndex
* Index of the adapter (iphlpapi-style) for which info is
* requested
*
* \param[out] DhcpEnabled
* Returns whether DHCP is enabled for the adapter
*
* \param[out] DhcpServer
* Returns DHCP server IP address (255.255.255.255 if no
* server reached yet), in network byte order
*
* \param[out] LeaseObtained
* Returns time at which the lease was obtained
*
* \param[out] LeaseExpires
* Returns time at which the lease will expire
*
* \return non-zero on success
*
* \remarks This is a ReactOS-only routine
*/
DWORD APIENTRY
DhcpRosGetAdapterInfo(DWORD AdapterIndex,
PBOOL DhcpEnabled,
PDWORD DhcpServer,
time_t* LeaseObtained,
time_t* LeaseExpires)
{
COMM_DHCP_REQ Req;
COMM_DHCP_REPLY Reply;
DWORD BytesRead;
BOOL Result;
ASSERT(PipeHandle != INVALID_HANDLE_VALUE);
Req.Type = DhcpReqGetAdapterInfo;
Req.AdapterIndex = AdapterIndex;
Result = TransactNamedPipe(PipeHandle,
&Req, sizeof(Req),
&Reply, sizeof(Reply),
&BytesRead, NULL);
if (Result && Reply.Reply != 0)
*DhcpEnabled = Reply.GetAdapterInfo.DhcpEnabled;
else
*DhcpEnabled = FALSE;
if (*DhcpEnabled)
{
*DhcpServer = Reply.GetAdapterInfo.DhcpServer;
*LeaseObtained = Reply.GetAdapterInfo.LeaseObtained;
*LeaseExpires = Reply.GetAdapterInfo.LeaseExpires;
}
else
{
*DhcpServer = INADDR_NONE;
*LeaseObtained = 0;
*LeaseExpires = 0;
}
return Reply.Reply;
}
static VOID
UpdateServiceStatus(DWORD dwState)
{

View file

@ -42,5 +42,4 @@
@ stub McastReleaseAddress
@ stub McastRenewAddress
@ stub McastRequestAddress
@ stdcall DhcpRosGetAdapterInfo(long ptr ptr ptr ptr)
@ stdcall ServiceMain(long ptr)

View file

@ -7,7 +7,6 @@ enum {
DhcpReqReleaseIpAddress,
DhcpReqRenewIpAddress,
DhcpReqStaticRefreshParams,
DhcpReqGetAdapterInfo,
};
typedef struct _COMM_DHCP_REQ {
@ -40,12 +39,6 @@ typedef union _COMM_DHCP_REPLY {
DWORD Mtu;
DWORD Speed;
} QueryHWInfo;
struct {
BOOL DhcpEnabled;
DWORD DhcpServer;
time_t LeaseObtained;
time_t LeaseExpires;
} GetAdapterInfo;
} COMM_DHCP_REPLY;
#define DHCP_PIPE_NAME L"\\\\.\\pipe\\dhcpclient"