250 likes | 434 Views
TamKang University Computer Science and Information Engineering. Member: 林玫君 資工 3D 李俊毅 資工 2B 陳 懷 資工 2B 李承恩 資工 2B 指導老師 : 石貴平 , 張志勇 助教 : Kevin Chang. OUTLINE. 組員分工 Introduction 技術分享 遭遇困難 未來規畫 參考資料. Work.
E N D
TamKang UniversityComputer Science and Information Engineering Member: 林玫君 資工3D 李俊毅 資工2B 陳 懷 資工2B 李承恩 資工2B 指導老師: 石貴平,張志勇 助教: Kevin Chang
OUTLINE • 組員分工 • Introduction • 技術分享 • 遭遇困難 • 未來規畫 • 參考資料
Work 林玫君 程式撰寫、投影片製作、報告 李俊毅 程式撰寫、投影片製作、報告 李承恩 投影片製作 陳 懷 投影片製作
軟體支援 • PCAUSA company • - Rawether for Windows – The "Win32 NDIS Framework“ (WinDis32) • provides a uniform user-mode interface to Windows network drivers
Rawether for Windows • directly access NDIS media-access controller (MAC) drivers on Windows platforms • •Network Monitors • Applications Which Use Non- Standard Protocols • Network Adapter Test Programs
名詞解釋 • NDIS:Network Driver Interface Specification(網路裝置介面規格) • SDK:software Development Kit • DDK:Driver Development Kit • OID:Object Identifier
What is NDIS • (Network Driver Interface Specification)網路裝置介面規格 • 由Microsoft及3Com聯合制定的資料連結層程式介面規格,是為了解決多協定共存於單一網路介面的問題 • 早期,用戶通常只利用單一通訊協定 • 現今,因應網路的互通,經由NDIS可以利用同一張網卡即可同時接受數種協定的存取
Adapter Operations • Finding Adapters • Opening Adapter • Getting NDIS Adapter Information • About WinDis 32 Adapter Handle And Filters • Receiving Packets • Point To Consider About Receiving Packets • Sending Packets • Packet I/O CompletionRoutine • Timestamp Control And Interpretation • Closing Adapters
Current • Show support Adapter • Show Adapter Information • Getting Adapter Name • Opening Adapter • Get ALL OID list
Finding Adapters • Adapter Enumeration • Adapter Selection
Finding Adapters (cont.) • Adapter Enumeration • Adapter Friendly Name: A human readable name that can be presented to a user to identify the adapter. • Adapter NDIS Name: A string token that is passed to the PCANDIS driver and eventually to NdisOpenAdapter. 例:\Device\{65A88950-829C-11D2-842E-81B82B383AF7}"
Technology • Visual C++ • Microsoft Foundation Class (MFC)
void CShowAdapterDlg::OnShowAdapter() • { • DWORD nResult; • W32N_ADAPTER_INFO AdapterInfo; • nResult = W32N_GetFirstAdapterRegistryInfo( &AdapterInfo ); • //抓第一個adapter • ptr->ResetContent(); //清空 IDC_LIST1 • ptr1->ResetContent(); //清空 IDC_LIST3 • while( !nResult ) • { • ptr->AddString(AdapterInfo.cTitle); //在IDC_LIST1 印出 Title • nResult = W32N_GetNextAdapterRegistryInfo( &AdapterInfo ); • //抓下一個 adapter • } • }
void CShowAdapterDlg::OnSelchangeList1() • { • DWORD nResult; • int i=0; • char array[50]="\\Device\\"; • W32N_ADAPTER_INFO AdapterInfo; • nResult = W32N_GetFirstAdapterRegistryInfo( &AdapterInfo ); • index=ptr->GetCurSel(); //抓目前選到的那個 • if(index!=LB_ERR) // LB_ERR 沒有任何被選取的話的回傳值 • { • while( !nResult ) { • if(i==index) • { ptr1->ResetContent(); //清空 • strcat(array,AdapterInfo.cServiceName); //將ServiceName接到array後面 • ptr1->AddString(AdapterInfo.cServiceName); • if(W32N_OpenAdapter(array)!=INVALID_HANDLE_VALUE) • ptr1->AddString("Open"); //有被open • else ptr1->AddString("Not open"); //沒有open • adapter=AdapterInfo.cTitle; • break; • } • else • { • nResult = W32N_GetNextAdapterRegistryInfo( &AdapterInfo ); • //不是目前選到的,抓下一個adapter • i++; • } • } • } • }
void CShowAdapterDlg::OnClear() • { • ptr->ResetContent(); • ptr1->ResetContent(); • ptr2->ResetContent(); • }
void CShowAdapterDlg::OnOID_List() • { • ptr2->ResetContent(); • OID_INFO_RECORD OidInfoDatabase[]= • { • 0x00010101, "OID_GEN_SUPPORTED_LIST", 0x00000000, • 0x00010102, "OID_GEN_HARDWARE_STATUS", 0x00000000, • 0x00010103, "OID_GEN_MEDIA_SUPPORTED", 0x00000000, • 0x00010104, "OID_GEN_MEDIA_IN_USE", 0x00000000, • 0x00010105, "OID_GEN_MAXIMUM_LOOKAHEAD", 0x00000000, • ……………………. • …………………… • }; • POID_INFO_RECORD pOID; • pOID=OidInfoDatabase; • char Temp[100]; • for(int i=0;i<100;i++,pOID++) • { • sprintf(Temp,"0x%8.8x %s ",pOID->m_nValue,pOID->m_strName); • ptr2->AddString(Temp); • } • }
Struct of OID_INFO_RECORD • typedef struct _OID_INFO_RECORD { DWORD m_nValue; char *m_strName; DWORD m_nFlags; } OID_INFO_RECORD, *POID_INFO_RECORD;
Suffer • Can not List Support OID. • MFC is very complex and we have to spend much time.
Future • Get Support OID to Query • Getting more information about MFC.
Reference • Visual C++ 6 Bible • 擁抱Visual C++ • PCAUSA Document • PCAUSA simple code