Konuyu Oyla:
  • Derecelendirme: 0/5 - 0 oy
  • 1
  • 2
  • 3
  • 4
  • 5
Dll çağırmada nerede hata yapıyorum ?
#1
Merhaba. Bu kodda nerede hata yapıyorum ? Dll cihaza hatasız komut veriyor ama sanırsam geri döndürmede hata ile karşılaşıyorum. pispc değişkenini var ve outta yaptığım halde hata alıyorum.

Dll açıklamasında bu şekilde çağırmamız gerektiğini söylüyor.


  QLIB_API unsigned char QLIB_DIAG_SPC_F(
     HANDLE hResourceContext, unsigned char iSPC[6], unsigned char* piSPC_Result );


Ben delphi olarak şu şekilde çağırıyorum.

  QLIB_DIAG_SPC_F = function(hResourceContext: Thandle; iSPC: array of Byte;

   piSPC_Result: array of Byte): ByteBool; stdcall;


Değişkenler bu şekilde.

  iSPC: array [0 .. $05] of Byte;
 RSPC: array [0 .. $05] of Byte;

Çağırma işleminide şu şekilde yapıyorum.

    ZeroMemory(@iSPC, SizeOf(iSPC));

   ZeroMemory(@RSpc, SizeOf(RSpc));
   iSPC[0] := (StrToInt(SpcNumber.Text[1]));
   iSPC[1] := (StrToInt(SpcNumber.Text[2]));
   iSPC[2] := (StrToInt(SpcNumber.Text[3]));
   iSPC[3] := (StrToInt(SpcNumber.Text[4]));
   iSPC[4] := (StrToInt(SpcNumber.Text[5]));
   iSPC[5] := (StrToInt(SpcNumber.Text[6]));

   DIAG_SPC_F(m_hPhone, iSPC, RSpc);

Ama şu şekilde hata alıyorum. 

7mp41g.png
Cevapla
#2
Son parametreyi PByte olarak verip çağırırken de DIAG_SPC_F(m_hPhone, iSPC, @RSpc[0]); bu şekilde çağırarak dener misiniz?
Herhangi bir basit problem, hakkında yeterince toplantı yapılarak, çözümsüz hale getirilebilir.
https://play.google.com/store/apps/developer?id=ONGUN
WWW
Cevapla
#3
(06-03-2020, Saat: 14:14)savasabd Adlı Kullanıcıdan Alıntı: Son parametreyi PByte olarak verip çağırırken de DIAG_SPC_F(m_hPhone, iSPC, @RSpc[0]); bu şekilde çağırarak dener misiniz?

Aynı hata hocam. Foksiyon için şu şekilde yazmışlar. Byte olarak yaptım gene aynı hata.

Alıntı:\param hResourceContext = Resource context that was returned from the call to QLIB_ConnectServer()

  \param  iSPC = array of 6 bytes, which hold the service programming code

              6 bytes of security code, in ASCII format (digits 0..9 only)

  \param   piSPC_Result = Result of the SPC

     \code

        1 = code was correct and Service Programming (SP) is unlocked

        0 = code was incorrect and SP is still locked

     \endcode



  \return true if successful, false if fail.



  \warning if the code was incorrect, the phone will time out for 10 sec

     before responding to any more requests through the serial interface.
Cevapla
#4
(06-03-2020, Saat: 14:23)seci20 Adlı Kullanıcıdan Alıntı:
(06-03-2020, Saat: 14:14)savasabd Adlı Kullanıcıdan Alıntı: Son parametreyi PByte olarak verip çağırırken de DIAG_SPC_F(m_hPhone, iSPC, @RSpc[0]); bu şekilde çağırarak dener misiniz?

Aynı hata hocam. Foksiyon için şu şekilde yazmışlar. Byte olarak yaptım gene aynı hata.

Alıntı:\param hResourceContext = Resource context that was returned from the call to QLIB_ConnectServer()

  \param  iSPC = array of 6 bytes, which hold the service programming code

              6 bytes of security code, in ASCII format (digits 0..9 only)

  \param   piSPC_Result = Result of the SPC

     \code

        1 = code was correct and Service Programming (SP) is unlocked

        0 = code was incorrect and SP is still locked

     \endcode



  \return true if successful, false if fail.



  \warning if the code was incorrect, the phone will time out for 10 sec

     before responding to any more requests through the serial interface.

Linki atar mısınız eğer varsa?
Herhangi bir basit problem, hakkında yeterince toplantı yapılarak, çözümsüz hale getirilebilir.
https://play.google.com/store/apps/developer?id=ONGUN
WWW
Cevapla
#5
(06-03-2020, Saat: 14:26)savasabd Adlı Kullanıcıdan Alıntı:
(06-03-2020, Saat: 14:23)seci20 Adlı Kullanıcıdan Alıntı: Aynı hata hocam. Foksiyon için şu şekilde yazmışlar. Byte olarak yaptım gene aynı hata.

Linki atar mısınız eğer varsa?

Buyrun hocam.

https://github.com/firstcst/W-R-Tools/bl...MSL_Diag.h
Cevapla
#6
Çağırma biçimini stdcall değil de cdecl yapar mısın hocam?
Herhangi bir basit problem, hakkında yeterince toplantı yapılarak, çözümsüz hale getirilebilir.
https://play.google.com/store/apps/developer?id=ONGUN
WWW
Cevapla
#7
(06-03-2020, Saat: 15:33)savasabd Adlı Kullanıcıdan Alıntı: Çağırma biçimini stdcall değil de cdecl yapar mısın hocam?

Yaptım hocam aynı hata. İletişimde sıkıntı yaşamamak adına.

  QLIB_DIAG_SPC_F = function(hResourceContext: Thandle; iSPC: array of Byte;

   piSPC_Result:  PByte): ByteBool; cdecl;


RSPC:  PByte;

    ZeroMemory(@iSPC, SizeOf(iSPC));

   ZeroMemory(@RSpc, SizeOf(RSpc));
   iSPC[0] := (StrToInt(SpcNumber.Text[1]));
   iSPC[1] := (StrToInt(SpcNumber.Text[2]));
   iSPC[2] := (StrToInt(SpcNumber.Text[3]));
   iSPC[3] := (StrToInt(SpcNumber.Text[4]));
   iSPC[4] := (StrToInt(SpcNumber.Text[5]));
   iSPC[5] := (StrToInt(SpcNumber.Text[6]));

   DIAG_SPC_F(m_hPhone, iSPC[0], @RSpc[0]);
Cevapla
#8
(06-03-2020, Saat: 15:38)seci20 Adlı Kullanıcıdan Alıntı:
(06-03-2020, Saat: 15:33)savasabd Adlı Kullanıcıdan Alıntı: Çağırma biçimini stdcall değil de cdecl yapar mısın hocam?

Yaptım hocam aynı hata. İletişimde sıkıntı yaşamamak adına.

  QLIB_DIAG_SPC_F = function(hResourceContext: Thandle; iSPC: array of Byte;

   piSPC_Result:  PByte): ByteBool; cdecl;


RSPC:  PByte;

    ZeroMemory(@iSPC, SizeOf(iSPC));

   ZeroMemory(@RSpc, SizeOf(RSpc));
   iSPC[0] := (StrToInt(SpcNumber.Text[1]));
   iSPC[1] := (StrToInt(SpcNumber.Text[2]));
   iSPC[2] := (StrToInt(SpcNumber.Text[3]));
   iSPC[3] := (StrToInt(SpcNumber.Text[4]));
   iSPC[4] := (StrToInt(SpcNumber.Text[5]));
   iSPC[5] := (StrToInt(SpcNumber.Text[6]));

   DIAG_SPC_F(m_hPhone, iSPC[0], @RSpc[0]);

 function MYQLIB_DIAG_SPC_F(hResourceContext: HWND; iSPC: array of Byte;
piSPC_Result: array of Byte): ByteBool; cdecl; external'QMSL_MSVC10R.dll' name 'QLIB_DIAG_SPC_F';
var
 Form8: TForm8;
  iSPC: array [0 .. 5] of Byte;
RSPC: array [0 .. 5] of Byte;

implementation

{$R *.dfm}

procedure TForm8.Button1Click(Sender: TObject);
begin
ZeroMemory(@iSPC, SizeOf(iSPC));

  ZeroMemory(@RSpc, SizeOf(RSpc));
  iSPC[0] := (8);//sayıları rastgele attım
  iSPC[1] := (2);
  iSPC[2] := (2);
  iSPC[3] := (6);
  iSPC[4] := (4);
  iSPC[5] := (5);

  MYQLIB_DIAG_SPC_F(self.Handle, iSPC, RSpc);//herhangi bir handle değeri olsun diye verdim self parametresini
end;

ben bu şekilde çağırdım,hata almadım.
Herhangi bir basit problem, hakkında yeterince toplantı yapılarak, çözümsüz hale getirilebilir.
https://play.google.com/store/apps/developer?id=ONGUN
WWW
Cevapla
#9
(06-03-2020, Saat: 15:46)savasabd Adlı Kullanıcıdan Alıntı:
(06-03-2020, Saat: 15:38)seci20 Adlı Kullanıcıdan Alıntı: Yaptım hocam aynı hata. İletişimde sıkıntı yaşamamak adına.

  QLIB_DIAG_SPC_F = function(hResourceContext: Thandle; iSPC: array of Byte;

   piSPC_Result:  PByte): ByteBool; cdecl;


RSPC:  PByte;

    ZeroMemory(@iSPC, SizeOf(iSPC));

   ZeroMemory(@RSpc, SizeOf(RSpc));
   iSPC[0] := (StrToInt(SpcNumber.Text[1]));
   iSPC[1] := (StrToInt(SpcNumber.Text[2]));
   iSPC[2] := (StrToInt(SpcNumber.Text[3]));
   iSPC[3] := (StrToInt(SpcNumber.Text[4]));
   iSPC[4] := (StrToInt(SpcNumber.Text[5]));
   iSPC[5] := (StrToInt(SpcNumber.Text[6]));

   DIAG_SPC_F(m_hPhone, iSPC[0], @RSpc[0]);

 function MYQLIB_DIAG_SPC_F(hResourceContext: HWND; iSPC: array of Byte;
piSPC_Result: array of Byte): ByteBool; cdecl; external'QMSL_MSVC10R.dll' name 'QLIB_DIAG_SPC_F';
var
 Form8: TForm8;
  iSPC: array [0 .. 5] of Byte;
RSPC: array [0 .. 5] of Byte;

implementation

{$R *.dfm}

procedure TForm8.Button1Click(Sender: TObject);
begin
ZeroMemory(@iSPC, SizeOf(iSPC));

  ZeroMemory(@RSpc, SizeOf(RSpc));
  iSPC[0] := (8);//sayıları rastgele attım
  iSPC[1] := (2);
  iSPC[2] := (2);
  iSPC[3] := (6);
  iSPC[4] := (4);
  iSPC[5] := (5);

  MYQLIB_DIAG_SPC_F(self.Handle, iSPC, RSpc);//herhangi bir handle değeri olsun diye verdim self parametresini
end;

ben bu şekilde çağırdım,hata almadım.

Hocam bende anlamadım nerede hata oluyor... Benzer foksiyon sorunsuz çalışırken bu foksiyonda hata veriyor.
Cevapla
#10
En son benim yazdığım şekilde denediniz mi?
Herhangi bir basit problem, hakkında yeterince toplantı yapılarak, çözümsüz hale getirilebilir.
https://play.google.com/store/apps/developer?id=ONGUN
WWW
Cevapla


Konu ile Alakalı Benzer Konular
Konular Yazar Yorumlar Okunma Son Yorum
  Değişik bir hata ikurt07 2 197 30-03-2024, Saat: 14:34
Son Yorum: ikurt07
  Rest Hata Yakalama m_ekici 9 1.552 08-03-2024, Saat: 19:30
Son Yorum: aegean
  Tanım Bulamadım Bu Hata İçin hi_selamlar 11 1.446 30-10-2023, Saat: 18:20
Son Yorum: hi_selamlar
  delphi de garip bir hata ercanskose 11 1.579 26-07-2023, Saat: 12:00
Son Yorum: delphiman
  UniDBGridColumnFilter Release Modda Hata veriyor yhackup 18 2.689 19-01-2023, Saat: 10:29
Son Yorum: yhackup



Konuyu Okuyanlar: 1 Ziyaretçi