Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

PCI slot number (NDIS)

Posted on 1998-09-27
1
Medium Priority
?
306 Views
Last Modified: 2013-12-03
How can I determine in the Miniport NIC driver the slot number of my card ??? Please give me a sample code.
0
Comment
Question by:kaccup
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 4

Accepted Solution

by:
agreen earned 1400 total points
ID: 1414850
You can do that by walking through the possible PCI slot numbers and examining the Vendor ID, Device ID and Revision Number of the card. Here is the sample:

#define MAX_PCI_SLOTS 25

#define VENDOR_ID  <your vendor id>
#define DEVICE_ID  <your device id>
#define REV_NUM    <revision number>

typedef struct _CMDD_PCI_CONFIG {
    USHORT VendorID;       
    USHORT DeviceID;
    USHORT Command;
    USHORT Status;
    UCHAR RevisionID;
    UCHAR ProgIf;
    UCHAR SubClass;
    UCHAR BaseClass;      
    UCHAR CacheLineSize;      
    UCHAR LatencyTimer;      
    UCHAR HeaderType;
    UCHAR BIST;      

    union {
         struct _PCI_HEADER_TYPE_0 {
             ULONG BaseAddresses[6];
             ULONG Reserved1[2];
             ULONG ROMBaseAddress;
             ULONG Reserved2[2];
             UCHAR InterruptLine;
             UCHAR InterruptPin;
             UCHAR MinimumGrant;
             UCHAR MaximumLatency;
         } type0;
     } u;
     UCHAR DeviceSpecific[192];
} PCI_CONFIG, *PPCI_CONFIG;

LONG
SlotNumber(
      PMY_ADAPTER Adapter
      )
{
    PCI_CONFIG PciConfig;
    UINT i;

    for(i=0; i<MAX_PCI_SLOTS; i++) {

        NdisReadPciSlotInformation(
          (NDIS_HANDLE)Adapter,
          i, 0, &PciConfig, sizeof(PCI_CONFIG));

        if(PciConfig.VendorID == VENDOR_ID && 
         PciConfig.DeviceID == DEVICE_ID &&
           PciConfig.RevisionID & 0x0f == REV_NUM) {

            // Place your code here

            return i;

        }

    return -1;
}
0

Featured Post

Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article, I will show how to use the Ribbon IDs Tool Window to assign the built-in Office icons to a ribbon button.  This tool will help us to find the OfficeImageId that corresponds to our desired built-in Office icon. The tool is part of…
What my article will show is if you ever had to do processing to a listbox without being able to just select all the items in it. My software Visual Studio 2008 crystal report v11 My issue was I wanted to add crystal report to a form and show…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question