Problem z DLL Nie znaleziono punktu wejścia

0

Witam !

Mam problem w komunikacji poprzez DLL. Próbuje wywołać funkcje SerialNumber i dostaje odpowiedz:

Nie znaleziono punktu wejścia procedury SerialNumber w bibliotece c:\MBT1ReceiverLib.dll.

Problem z umiejscowieniem DLL załatwiłem poprzez C:, niemniej jedyne eksportowane metody w tym DLL to

  • DllCanUnloadNow
  • DllGetClassObject
  • DllRegisterServer
  • DllUnregisterServer

Kod jakim się dobieram i dostaje komunikat błędu to:

var
  Form1: TForm1;

implementation

  function Get_SerialNumber: WideString; safecall; External 'C:\MBT1ReceiverLib.dll' name 'SerialNumber';

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var
  str : String;
begin
  str := Get_SerialNumber;
end;
 

Co ważne wiem ze ten DLL ma te funkcje bo tak wynika z innych przykładów napisanych w VB

Poza tym za pomocą kontrolek ActixeX i COM i nawet nie wiem dokładnie czego jeszcze (korzystając z jednego z licznych opisów na forum) wygenerowałem ;-) (czytaj Delphi wygenerowało) plik nieco mówiący o zawartości tego DLL-a, niemniej nie ma pojęcia jak się do tego dobrać bo te funkcje nie są eksportowane na zewnątrz wiec ani ja ani PEInfo.exe ich nie widza i chyba dlatego Delphi wywala błąd.

Uprzejmie proszę o pomoc w postaci informacji, jak odwołać się do poniższych funkcji z DLLa by działały.

W razie potrzeby w znaczniku wspomniany DLL, oraz przykład jak to robić w VB tyle że też nie działający.

unit MBT1ReceiverLibLib_TLB;

// ************************************************************************ //
// WARNING                                                                    
// -------                                                                    
// The types declared in this file were generated from data read from a       
// Type Library. If this type library is explicitly or indirectly (via        
// another type library referring to this type library) re-imported, or the   
// 'Refresh' command of the Type Library Editor activated while editing the   
// Type Library, the contents of this file will be regenerated and all        
// manual modifications will be lost.                                         
// ************************************************************************ //

// PASTLWTR : 1.2
// File generated on 2013-03-13 22:04:20 from Type Library described below.

// ************************************************************************  //
// Type Lib: C:\Program Files\MBT1USB\Developer\MBT1ReceiverLib.dll (1)
// LIBID: {946ABAE2-0B60-4377-BD0E-F81E8A5F9062}
// LCID: 0
// Helpfile: 
// HelpString: MBT1ReceiverLib 1.0 Type Library
// DepndLst: 
//   (1) v2.0 stdole, (C:\WINDOWS\system32\stdole2.tlb)
// Parent TypeLibrary:
//   (0) v1.0 ActiveFormProj1, (C:\Program Files\Borland\Delphi7\Projects\ActiveFormProj1.tlb)
// ************************************************************************ //
{$TYPEDADDRESS OFF} // Unit must be compiled without type-checked pointers. 
{$WARN SYMBOL_PLATFORM OFF}
{$WRITEABLECONST ON}
{$VARPROPSETTER ON}
interface

uses Windows, ActiveX, Classes, Graphics, OleCtrls, OleServer, StdVCL, Variants;
  


// *********************************************************************//
// GUIDS declared in the TypeLibrary. Following prefixes are used:        
//   Type Libraries     : LIBID_xxxx                                      
//   CoClasses          : CLASS_xxxx                                      
//   DISPInterfaces     : DIID_xxxx                                       
//   Non-DISP interfaces: IID_xxxx                                        
// *********************************************************************//
const
  // TypeLibrary Major and minor versions
  MBT1ReceiverLibLibMajorVersion = 1;
  MBT1ReceiverLibLibMinorVersion = 0;

  LIBID_MBT1ReceiverLibLib: TGUID = '{946ABAE2-0B60-4377-BD0E-F81E8A5F9062}';

  IID_IMBT1Receiver: TGUID = '{9DF0B13A-8587-4C44-B584-BE209D51D647}';
  CLASS_MBT1Receiver: TGUID = '{D4B4EC90-052B-422C-B8D3-F36197C7FC23}';
type

// *********************************************************************//
// Forward declaration of types defined in TypeLibrary                    
// *********************************************************************//
  IMBT1Receiver = interface;
  IMBT1ReceiverDisp = dispinterface;

// *********************************************************************//
// Declaration of CoClasses defined in Type Library                       
// (NOTE: Here we map each CoClass to its Default Interface)              
// *********************************************************************//
  MBT1Receiver = IMBT1Receiver;


// *********************************************************************//
// Interface: IMBT1Receiver
// Flags:     (4544) Dual NonExtensible OleAutomation Dispatchable
// GUID:      {9DF0B13A-8587-4C44-B584-BE209D51D647}
// *********************************************************************//
  IMBT1Receiver = interface(IDispatch)
    ['{9DF0B13A-8587-4C44-B584-BE209D51D647}']
    function Get_SearchThreadRuns: Integer; safecall;
    function Get_SearchThreadBreak: Integer; safecall;
    procedure Set_SearchThreadBreak(pVal: Integer); safecall;
    function Get_CommunicationThreadRuns: Integer; safecall;
    function Get_CommunicationThreadBreak: Integer; safecall;
    procedure Set_CommunicationThreadBreak(pVal: Integer); safecall;
    procedure SearchThreadStart; safecall;
    function Get_CurrentCOMPort: Integer; safecall;
    procedure Set_CurrentCOMPort(pVal: Integer); safecall;
    procedure SearchThreadEnd; safecall;
    function Get_USBComPortType: Integer; safecall;
    procedure Set_USBComPortType(pVal: Integer); safecall;
    procedure ReadParameter; safecall;
    function Get_RadioPasskey(RadioPassNumber: Integer): WideString; safecall;
    procedure Set_RadioPasskey(RadioPassNumber: Integer; const pVal: WideString); safecall;
    function Get_RadioPasskey128(RadioPassNumber: Integer): WideString; safecall;
    procedure Set_RadioPasskey128(RadioPassNumber: Integer; const pVal: WideString); safecall;
    function Get_FirmwareVersion: WideString; safecall;
    function Get_SerialNumber: WideString; safecall;
    procedure Set_SerialNumber(const pVal: WideString); safecall;
    procedure StartRadioReading; safecall;
    function Get_NextRadioTelegram: WideString; safecall;
    procedure TelegramInterpret(const MBTel: WideString; DecryptValid: Integer); safecall;
    function Get_RADManufacturer: WideString; safecall;
    function Get_RADDeviceAddress: WideString; safecall;
    function Get_AddressInterpretationSetting: Integer; safecall;
    procedure Set_AddressInterpretationSetting(pVal: Integer); safecall;
    function Get_LanguageSetting: Integer; safecall;
    procedure Set_LanguageSetting(pVal: Integer); safecall;
    function Get_RADGeneration: WideString; safecall;
    function Get_RADMedium: WideString; safecall;
    function Get_RADCIField: WideString; safecall;
    function Get_RADTransCount: WideString; safecall;
    function Get_RADStatus: WideString; safecall;
    function Get_RADSignature: WideString; safecall;
    function Get_RADNumberOfDatarecords: Integer; safecall;
    function Get_RADDatarecordValue(DRNumber: Integer): WideString; safecall;
    function Get_RADDatarecordUnit(DRNumber: Integer): WideString; safecall;
    function Get_DecimalSetting: Integer; safecall;
    procedure Set_DecimalSetting(pVal: Integer); safecall;
    function Get_RADExtractRecTime(const TelStr: WideString): WideString; safecall;
    function Get_RADExtractSignalStrength(const TelStr: WideString): WideString; safecall;
    function Get_RADExtractDecipherValid(const TelStr: WideString): Integer; safecall;
    procedure ReadClock; safecall;
    procedure WriteClock; safecall;
    function Get_RTCYear: Integer; safecall;
    procedure Set_RTCYear(pVal: Integer); safecall;
    function Get_RTCMonth: Integer; safecall;
    procedure Set_RTCMonth(pVal: Integer); safecall;
    function Get_RTCDay: Integer; safecall;
    procedure Set_RTCDay(pVal: Integer); safecall;
    function Get_RTCHour: Integer; safecall;
    procedure Set_RTCHour(pVal: Integer); safecall;
    function Get_RTCMinute: Integer; safecall;
    procedure Set_RTCMinute(pVal: Integer); safecall;
    function Get_RTCSecond: Integer; safecall;
    procedure Set_RTCSecond(pVal: Integer); safecall;
    function Get_RTCString: WideString; safecall;
    property TelegramDecipher[const MBTelIn: WideString]: WideString read Get_TelegramDecipher;
  end;

// *********************************************************************//
// DispIntf:  IMBT1ReceiverDisp
// Flags:     (4544) Dual NonExtensible OleAutomation Dispatchable
// GUID:      {9DF0B13A-8587-4C44-B584-BE209D51D647}
// *********************************************************************//
  IMBT1ReceiverDisp = dispinterface
    ['{9DF0B13A-8587-4C44-B584-BE209D51D647}']
    property SearchThreadRuns: Integer readonly dispid 1;
    property SearchThreadBreak: Integer dispid 2;
    property CommunicationThreadRuns: Integer readonly dispid 3;
    property CommunicationThreadBreak: Integer dispid 4;
    procedure SearchThreadStart; dispid 5;
    property CurrentCOMPort: Integer dispid 6;
    procedure SearchThreadEnd; dispid 7;
    property USBComPortType: Integer dispid 8;
    procedure ReadParameter; dispid 9;
    property RadioPasskey[RadioPassNumber: Integer]: WideString dispid 10;
    property RadioPasskey128[RadioPassNumber: Integer]: WideString dispid 11;
    property FirmwareVersion: WideString readonly dispid 12;
    property SerialNumber: WideString dispid 13;
    procedure StartRadioReading; dispid 14;
    property NextRadioTelegram: WideString readonly dispid 15;
    procedure TelegramInterpret(const MBTel: WideString; DecryptValid: Integer); dispid 16;
    property RADManufacturer: WideString readonly dispid 17;
    property RADDeviceAddress: WideString readonly dispid 18;
    property AddressInterpretationSetting: Integer dispid 19;
    property LanguageSetting: Integer dispid 20;
    property RADGeneration: WideString readonly dispid 21;
    property RADMedium: WideString readonly dispid 22;
    property RADCIField: WideString readonly dispid 23;
    property RADTransCount: WideString readonly dispid 24;
    property RADStatus: WideString readonly dispid 25;
    property RADSignature: WideString readonly dispid 26;
    property RADNumberOfDatarecords: Integer readonly dispid 27;
    property RADDatarecordValue[DRNumber: Integer]: WideString readonly dispid 28;
    property RADDatarecordUnit[DRNumber: Integer]: WideString readonly dispid 29;
    property DecimalSetting: Integer dispid 30;
    property RADExtractRecTime[const TelStr: WideString]: WideString readonly dispid 31;
    property RADExtractSignalStrength[const TelStr: WideString]: WideString readonly dispid 32;
    property RADExtractDecipherValid[const TelStr: WideString]: Integer readonly dispid 33;
    procedure ReadClock; dispid 34;
    procedure WriteClock; dispid 35;
    property RTCYear: Integer dispid 36;
    property SEROpenDelay: Integer dispid 241;
    property ReceiverSensitivity: Integer dispid 242;
    procedure FTPStartConfigRadioRemoteUpload(const newVal: WideString); dispid 243;
    property CurrentCOMPort2: WideString dispid 244;
    property TelegramDecipher[const MBTelIn: WideString]: WideString readonly dispid 245;
    procedure RADSendRadioTelegram(RMode: Integer; RSet: Integer; RSpeed: Integer; 
                                   const RAddr: WideString; RTelLen: Integer; 
                                   const RTelg: WideString); dispid 246;
  end;

implementation

uses ComObj;

end.

0

COM to nie zwykłe DLL, nie wywołuje się tego przez calle do DLLki tylko tworzy obiekty COM, ActiveX czy jak to się tam nazywa.

2

przecież to jest ActiveX i tego się całkiem inaczej używa! Zresztą w przykładzie, który dałeś jest to całkiem inaczej zrobione niż tak jak Ty robisz.

Najpierw go trzeba zarejestrować w systemie (o ile instalator tego nie zrobił wcześniej) przez regsvr32 ścieżka_do _dll a potem Rozdział 13

0

Witam !

Dzięki wielkie abrakadaber za jasną i rzeczową odpowiedź, w odróżnieniu od odpowiedzi proqix wnosi coś do sprawy a nie jedynie pogłębia frustrację ;-)

Jak widać z mojego pierwszego postu to trochę pogrzebałem na ten temat, i nawet byłem na stronie z Twojego Linka, zresztą idąc jedna z informacji z początku tej strony wygenerowałem te pliki ;-) Niemniej ta sekcja wydała mi się nie na temat bo prosili o jakiegoś OCX -sa a ja miałem tylko tego DLL -a.

Tak czy siak z programowania jestem zielony jak szczypiorek na wiosnę ;-) niemniej temat dzięki Twej podpowiedzi oraz skierowaniu mnie na właściwe tory rozumowania rozwiązałem, mam komunikacje z tą biblioteka, i wszystko działa Tip Top.

Pytanie dodatkowe które może pomóc pewnie nie tylko mnie, to jak rozróżnić sposób podejścia do DLL, jeśli nie ma żadnej dokumentacji ? Jak dowiedzieć się czy to Active X czy zwykły DLL ? Pytanie jest na przyszłość bo w tym przypadku był to Active X.

jeszcze raz dziękuje bardzo za pomoc i pozdrawiam

1
szymon-ek napisał(a):

Pytanie dodatkowe które może pomóc pewnie nie tylko mnie, to jak rozróżnić sposób podejścia do DLL, jeśli nie ma żadnej dokumentacji ? Jak dowiedzieć się czy to Active X czy zwykły DLL ? Pytanie jest na przyszłość bo w tym przypadku był to Active X.

Jeżeli się nie mylę, to kontrolki ActiveX mają wyeksportowane funkcje o nazwach: DllRegisterServer i DllUnregisterServer. Są one potrzebne aby mógł się nimi "zająć" wspomiany 'regsvr32`. Na ogól pliki tych kontolek chyba nie bywają dodatkowo obfuscowane czy spakowane, więc można te wyrazy znaleźć na przykład w managerach plików w podglądzie danego pliku. Albo odpowiednimi pluginami, które dostarczają informacji o plikach PE. Osobiście format PE znam tak sobie, raczej słabo, ale wydaje mi się, że dllki może poza jakimiś szczegółnymi przypadkami mają i tak widoczne eksporty. Sugeruję się tutaj nawet takimi tworami, jednej grupy z "anielskim" numerem w nazwie, gdzie ich dllka na pewno jest odpowiednio zabezpieczona przed wścibskimi oczami początkujących reverserów, ale eksporty i tak ma widoczne.

0

Witam !

OK Dzięki, komplet odp mam, wszytko działa, ogólnie rewelacja ;-)

Dziękuje, pozdrawiam, Temat do zamknięcia czyli rozwiązany ;-)

0

albo można po prostu spróbować ją zarejestrować przez regsvr32 i jeśli się uda to ocx a jak nie to zwykły dll

1 użytkowników online, w tym zalogowanych: 0, gości: 1