Jump to content

DllCall Packet.dll


themax90
 Share

Recommended Posts

I am trying to call Packet.dll to get the version name but have stumbled across an error.

Here is my code

Local $DllName = "Packet.dll"
$PacketVersion = DllCall($DllName, "none", "PacketGetVersion")
If $PacketVersion <> 0 Then Exit MsgBox(0, $PacketVersion, "Success")
MsgBox(0, $PacketVersion, "Failure")

My problem is I do not know the return type. Here is the API Call as in Packet32.c Source:

http://dog.tele.jp/winpcap/html/Packet32_8...rce.html#l00343

00343 char PacketLibraryVersion[] = "3.0 alpha3"; 
00344 
00349 PCHAR PacketGetVersion(){
00350    return PacketLibraryVersion;
00351 }

I have found a byte reference and this is it:

Listing 3.1  Determining the Size of Variable Types on Your Computer

  0:  #include <iostream>
  1:  
  2:  int main()
  3:  {
  4:     using std::cout;
  5:  
  6:     cout << "The size of an int is:\t\t"   
  7:        << sizeof(int)  << " bytes.\n";
  8:     cout << "The size of a short int is:\t" 
  9:        << sizeof(short)  << " bytes.\n";
 10:     cout << "The size of a long int is:\t"  
 11:        << sizeof(long)   << " bytes.\n";
 12:     cout << "The size of a char is:\t\t"   
 13:        << sizeof(char)   << " bytes.\n";
 14:     cout << "The size of a float is:\t\t"   
 15:         << sizeof(float)  << " bytes.\n";
 16:     cout << "The size of a double is:\t"   
 17:        << sizeof(double) << " bytes.\n";
 18:     cout << "The size of a bool is:\t"   
 19:        << sizeof(bool)   << " bytes.\n";
 20:  
 21:     return 0;
 22:  }

Output

The size of an int is:        4 bytes.
The size of a short int is:  2 bytes.
The size of a long int is:    4 bytes.
The size of a char is:        1 bytes.
The size of a float is:      4 bytes.
The size of a double is:        8 bytes.
The size of a bool is:        1 bytes.

Also here is the Packet.dll functions:

http://dog.tele.jp/winpcap/html/group__packet32.html

Here is Packet.dll:

Since people have been asking for a Packet Sniffer, I have set out to make one, but when I try using the return value of str, or none, it returns 0 which it should return 3.0 alpha3 I hope a C++ guru or dev can help me with this, I'm new to this whole Dll mess and seem to have forgotten some of my programming things and lost my reference books.

Thanks,

AutoIt Smith

Link to comment
Share on other sites

might want to check your @error right after the dll call, it gets set to 1

Return Value

Success: @error = 0.

Failure: @error = 1 unable to use the DLL file,

@error = 2 unknown "return type".

Edited by gafrost

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

But why is it unable to use the file, it is a valid library and in the same directory. I need an example to retreive what I am looking for so I can understand it. Is there a problem with the return value or syntax of the call?

Edited by AutoIt Smith
Link to comment
Share on other sites

Since people have been asking for a Packet Sniffer, I have set out to make one, but when I try using the return value of str, or none, it returns 0 which it should return 3.0 alpha3 I hope a C++ guru or dev can help me with this, I'm new to this whole Dll mess and seem to have forgotten some of my programming things and lost my reference books.

@Error Returns 1, $PacketVersion = 0 . Failure

Edited by AutoIt Smith
Link to comment
Share on other sites

Local $Dll = DllOpen("Packet.dll")
$PacketVersion = DllCall($Dll, "str", "PacketGetVersion")
If IsArray($PacketVersion) Then
    MsgBox(64, "Success", "Packet Version: " & $PacketVersion[0])
Else
    MsgBox(16, "Failure", "There was an error with the DllCall!")
EndIf

Link to comment
Share on other sites

// Generated by PE Explorer 1.97 (www.heaventools.com)

// File name: C:\Documents and Settings\Administrator\Local Settings\Temporary Internet Files\Content.IE5\WVZ3AWLX\Packet[1].dll

// Created : 13.12.2005 01:00

// Type : Exports

// PacketAllocatePacket; Index 1; Information not available

// PacketCloseAdapter; Index 2; Information not available

// PacketFreePacket; Index 3; Information not available

// PacketGetAdapterNames; Index 4; Information not available

// PacketGetNetType; Index 5; Information not available

// PacketGetStats; Index 6; Information not available

// PacketInitPacket; Index 7; Information not available

// PacketOpenAdapter; Index 8; Information not available

// PacketReceivePacket; Index 9; Information not available

// PacketRequest; Index 10; Information not available

// PacketResetAdapter; Index 11; Information not available

// PacketSendPacket; Index 12; Information not available

// PacketSetBpf; Index 13; Information not available

// PacketSetBuff; Index 14; Information not available

// PacketSetHwFilter; Index 15; Information not available

// PacketSetMode; Index 16; Information not available

// PacketSetNumWrites; Index 17; Information not available

// PacketSetReadTimeout; Index 18; Information not available

// PacketWaitPacket; Index 19; Information not available

http://www.myclanhosting.com/defiasVisit Join and contribute to a soon to be leader in Custumized tools development in [C# .Net 1.1 ~ 2.0/C/C++/MFC/AutoIt3/Masm32]
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...