专有DLL在3h45m后返回空文件

时间:2015-02-13 22:50:34

标签: c++ file-io dll openframeworks

我正在使用专有DLL(CP5200.dll)与10个滚动消息LED标志进行通信。我正在使用openFrameworks生成并保存我想要显示的文本的图像,然后使用DLL将图像打包成符号可以处理的数据。

我每分钟调用几次以下函数,并返回2-4kb的文件,具体取决于图像大小,但在某个时刻 - 启动后大约3小时45分钟,它们开始返回128字节的文件,上传时会导致LED显示为空白。我假设dll中有一个缓冲区没有被清空,或类似的东西,但我无法理解反编译的代码。

以下是功能:

int CP5200_Program_AddPicture(HOBJECT hObj, int nWinNo, const char* pPictFile, int nMode, int nEffect, int nSpeed, int nStay, int nCompress)
int CP5200_Program_SaveToFile(HOBJECT hObj, const char* pFilename)

反编译功能:

Exported fn(): CP5200_Program_AddImage - Ord:00C3h
:1000FD20 51                      push ecx
:1000FD21 55                      push ebp
:1000FD22 8B6C240C                mov ebp, dword ptr [esp+0C]
:1000FD26 85ED                    test ebp, ebp
:1000FD28 7508                    jne 1000FD32
:1000FD2A 83C8FF                  or eax, FFFFFFFF
:1000FD2D 5D                      pop ebp
:1000FD2E 59                      pop ecx
:1000FD2F C23000                  ret 0030

功能完全拆解。我无法反编译。

:1000FC50 ; Exported entry  15. CP5200_Program_AddPicture
:1000FC50
:1000FC50 ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E   ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
:1000FC50
:1000FC50
:1000FC50                 public CP5200_Program_AddPicture
:1000FC50 CP5200_Program_AddPicture proc near
:1000FC50
:1000FC50 arg_0           = dword ptr  8
:1000FC50 arg_4           = dword ptr  0Ch
:1000FC50 arg_8           = dword ptr  10h
:1000FC50 arg_C           = dword ptr  14h
:1000FC50 arg_10          = dword ptr  18h
:1000FC50 arg_14          = dword ptr  1Ch
:1000FC50 arg_18          = dword ptr  20h
:1000FC50 arg_1C          = dword ptr  24h
:1000FC50
:1000FC50                 push    ebx
:1000FC51                 mov     ebx, [esp+arg_0]
:1000FC55                 test    ebx, ebx
:1000FC57                 jnz     short loc_1000FC60
:1000FC59                 or      eax, 0FFFFFFFFh
:1000FC5C                 pop     ebx
:1000FC5D                 retn    20h
:1000FC60 ; ---------------------------------------------------------------------------
:1000FC60
:1000FC60 loc_1000FC60:                           ; CODE XREF: CP5200_Program_AddPicture+7j
:1000FC60                 push    esi
:1000FC61                 push    edi
:1000FC62                 mov     edi, ebx
:1000FC64                 mov     esi, offset aCprogram ; "CProgram"
:1000FC69                 mov     ecx, 9
:1000FC6E                 xor     eax, eax
:1000FC70                 repe cmpsb
:1000FC72                 jz      short loc_1000FC79
:1000FC74                 sbb     eax, eax
:1000FC76                 sbb     eax, 0FFFFFFFFh
:1000FC79
:1000FC79 loc_1000FC79:                           ; CODE XREF: CP5200_Program_AddPicture+22j
:1000FC79                 test    eax, eax
:1000FC7B                 jz      short loc_1000FC86
:1000FC7D                 pop     edi
:1000FC7E                 pop     esi
:1000FC7F                 or      eax, 0FFFFFFFFh
:1000FC82                 pop     ebx
:1000FC83                 retn    20h
:1000FC86 ; ---------------------------------------------------------------------------
:1000FC86
:1000FC86 loc_1000FC86:                           ; CODE XREF: CP5200_Program_AddPicture+2Bj
:1000FC86                 mov     esi, [esp+8+arg_4]
:1000FC8A                 test    esi, esi
:1000FC8C                 jl      short loc_1000FD07
:1000FC8E                 mov     ecx, ebx
:1000FC90                 call    sub_10018020
:1000FC95                 cmp     esi, eax
:1000FC97                 jge     short loc_1000FD07
:1000FC99                 push    esi
:1000FC9A                 mov     ecx, ebx
:1000FC9C                 call    sub_10018030
:1000FCA1                 push    3Eh
:1000FCA3                 mov     edi, eax
:1000FCA5                 call    ??2@YAPAXI@Z    ; operator new(uint)
:1000FCAA                 add     esp, 4
:1000FCAD                 test    eax, eax
:1000FCAF                 jz      short loc_1000FCBE
:1000FCB1                 mov     ecx, eax
:1000FCB3                 call    sub_100012E0
:1000FCB8                 mov     esi, eax
:1000FCBA                 test    esi, esi
:1000FCBC                 jnz     short loc_1000FCC9
:1000FCBE
:1000FCBE loc_1000FCBE:                           ; CODE XREF: CP5200_Program_AddPicture+5Fj
:1000FCBE                 pop     edi
:1000FCBF                 pop     esi
:1000FCC0                 mov     eax, 0FFFFFFFCh
:1000FCC5                 pop     ebx
:1000FCC6                 retn    20h
:1000FCC9 ; ---------------------------------------------------------------------------
:1000FCC9
:1000FCC9 loc_1000FCC9:                           ; CODE XREF: CP5200_Program_AddPicture+6Cj
:1000FCC9                 mov     eax, [esp+8+arg_8]
:1000FCCD                 push    eax
:1000FCCE                 lea     ecx, [esi+25h]
:1000FCD1                 call    sub_100076A0
:1000FCD6                 mov     ecx, [esp+8+arg_C]
:1000FCDA                 mov     edx, [esp+8+arg_10]
:1000FCDE                 mov     eax, [esp+8+arg_14]
:1000FCE2                 mov     [esi+2Ah], ecx
:1000FCE5                 mov     ecx, [esp+8+arg_18]
:1000FCE9                 mov     [esi+2Eh], edx
:1000FCEC                 mov     edx, [esp+8+arg_1C]
:1000FCF0                 mov     [esi+36h], ecx
:1000FCF3                 push    esi
:1000FCF4                 mov     ecx, edi
:1000FCF6                 mov     [esi+32h], eax
:1000FCF9                 mov     [esi+3Ah], edx
:1000FCFC                 call    sub_100015A0
:1000FD01                 pop     edi
:1000FD02                 pop     esi
:1000FD03                 pop     ebx
:1000FD04                 retn    20h
:1000FD0F CP5200_Program_AddPicture endp


Exported fn(): CP5200_Program_SaveToFile - Ord:0013h
:1000CE80 8B542404                mov edx, dword ptr [esp+04]
:1000CE84 85D2                    test edx, edx
:1000CE86 741F                    je 1000CEA7
:1000CE88 56                      push esi
:1000CE89 57                      push edi 
:1000CE8A 8BFA                    mov edi, edx
:1000CE8C BE8C060610              mov esi, 1006068C
:1000CE91 B909000000              mov ecx, 00000009
:1000CE96 33C0                    xor eax, eax
:1000CE98 F3                      repz
:1000CE99 A6                      cmpsb
:1000CE9A 5F                      pop edi
:1000CE9B 5E                      pop esi
:1000CE9C 7405                    je 1000CEA3
:1000CE9E 1BC0                    sbb eax, eax
:1000CEA0 83D8FF                  sbb eax, FFFFFFFF

我在VS 2012中写作,openframeworks版本为_v0.8.3_vs_release。

反编译代码是否提供了导致此行为的DLL中发生的任何线索?

0 个答案:

没有答案