---------------------------------------------------------------------------
                      [BUG/PRB.] VFP 9.0 FIX - USE SET LIBRARY TO OPEN A PROCEDURE FILE
                                  July 2026
                 ---------------------------------------------------------------------------
                                     CCB



1. BUG:

     In vfp9 (and vfp6, vfp7, vfp8), we can use SET LIBRARY to open an API library file or a procedure file.

     In VFP Advanced, we can use SET LIBRARY to open an API library file, we cannot use SET LIBRARY to open a procedure file.


2. CAUSE:

     There are some BUGs in the following code.


3. RESOLUTION:

     We can write some code to fix the BUG.

     Fun7c34b4 :: ; proc near
             push ebp                                                        ;0x007c34b4 :        55
             lea ebp ,  dword ptr [ esp + 0FFFFFDB4h ]                       ;0x007c34b5 :        8dac24b4fdffff
             sub esp , 02D8h                                                 ;0x007c34bc :        81ecd8020000
             mov eax ,  dword ptr [ Data937090 ]                             ;0x007c34c2 :        a190709300
             push ebx                                                        ;0x007c34c7 :        53
             push esi                                                        ;0x007c34c8 :        56
             push edi                                                        ;0x007c34c9 :        57
             mov  edi , dword ptr [ ebp + 0258h ]                            ;0x007c34ca :        8bbd58020000
             mov  dword ptr [ ebp + 0248h ] , eax                            ;0x007c34d0 :        898548020000
             mov eax , edi                                                   ;0x007c34d6 :        8bc7
             lea ecx ,  dword ptr [ eax + 1 ]                                ;0x007c34d8 :        8d4801

     Label7c34db ::
             mov  dl , byte ptr [eax]                                        ;0x007c34db :        8a10
             inc eax                                                         ;0x007c34dd :        40
             test dl , dl                                                    ;0x007c34de :        84d2
             jne Label7c34db                                                 ;0x007c34e0 :        75f9
             xor ebx , ebx                                                   ;0x007c34e2 :        33db
             push ebx                                                        ;0x007c34e4 :        53
             pushd offset Data93a8c0                                                  ;0x007c34e5 :        68c0a89300
             sub eax , ecx                                                   ;0x007c34ea :        2bc1
             mov esi , offset Data925a30                                              ;0x007c34ec :        be305a9200
             push esi                                                        ;0x007c34f1 :        56
             push eax                                                        ;0x007c34f2 :        50
             mov edx , edi                                                   ;0x007c34f3 :        8bd7
             lea ecx ,  dword ptr [ ebp + 013Ch ]                            ;0x007c34f5 :        8d8d3c010000
             call Fun42cc34                                                  ;0x007c34fb :        e83497c6ff
             test eax , eax                                                  ;0x007c3500 :        85c0
             jne Label7c353d                                                 ;0x007c3502 :        7539
             mov eax , edi                                                   ;0x007c3504 :        8bc7
             lea edx ,  dword ptr [ eax + 1 ]                                ;0x007c3506 :        8d5001

     Label7c3509 ::
             mov  cl , byte ptr [eax]                                        ;0x007c3509 :        8a08
             inc eax                                                         ;0x007c350b :        40
             test cl , cl                                                    ;0x007c350c :        84c9
             jne Label7c3509                                                 ;0x007c350e :        75f9
             push ebx                                                        ;0x007c3510 :        53
             pushd offset Data935b20                                                  ;0x007c3511 :        68205b9300
             sub eax , edx                                                   ;0x007c3516 :        2bc2
             push esi                                                        ;0x007c3518 :        56
             push eax                                                        ;0x007c3519 :        50
             mov edx , edi                                                   ;0x007c351a :        8bd7
             lea ecx ,  dword ptr [ ebp + 013Ch ]                            ;0x007c351c :        8d8d3c010000
             call Fun42cc34                                                  ;0x007c3522 :        e80d97c6ff
             test eax , eax                                                  ;0x007c3527 :        85c0
             jne Label7c353d                                                 ;0x007c3529 :        7512


     ;
     ;                 ----------------------------------------------------------------
     ;                      VFP 9.0 FIX - USE SET LIBRARY TO OPEN A PROCEDURE FILE
     ;                                  July 2026
     ;                 ----------------------------------------------------------------
     ;                                     CCB
     ;
     ; Use SET LIBRARY to open a procedure file.
     ;
     ; 2026/7/17, by ccb
     ;

             cmp dword ptr vfpa_sys9208_data,00h
             jne Label7c352b
             jmp Label7c3533


     Label7c352b ::
             cmp  dword ptr [ ebp + 025Ch ] , ebx                            ;0x007c352b :        399d5c020000
             jne Label7c35b2                                                 ;0x007c3531 :        757f

     Label7c3533 ::
             mov ecx , 02D6h                                                 ;0x007c3533 :        b9d6020000
             call Fun544742                                                  ;0x007c3538 :        e80512d8ff

     Label7c353d ::
             xor edx , edx                                                   ;0x007c353d :        33d2
             lea ecx ,  dword ptr [ ebp + 013Ch ]                            ;0x007c353f :        8d8d3c010000
             call Fun43d2bf                                                  ;0x007c3545 :        e8759dc7ff
             mov edi , eax                                                   ;0x007c354a :        8bf8
             mov  ecx , dword ptr [edi]                                      ;0x007c354c :        8b0f
             mov edx , 0105h                                                 ;0x007c354e :        ba05010000
             lea eax ,  dword ptr [ ebp + 52 ]                               ;0x007c3553 :        8d4534
             call Fun42c33e                                                  ;0x007c3556 :        e8e38dc6ff
             lea eax ,  dword ptr [ ebp + 52 ]                               ;0x007c355b :        8d4534
             push eax                                                        ;0x007c355e :        50
             push  dword ptr [ ebp + 0254h ]                                 ;0x007c355f :        ffb554020000
             call Fun7c3a0c                                                  ;0x007c3565 :        e8a2040000
             test eax , eax                                                  ;0x007c356a :        85c0
             jle Label7c357a                                                 ;0x007c356c :        7e0c
             mov ecx , edi                                                   ;0x007c356e :        8bcf
             call Fun42c1e2                                                  ;0x007c3570 :        e86d8cc6ff
             jmp Label7c3758                                                 ;0x007c3575 :        e9de010000

     Label7c357a ::
             mov  rsi , SetErrorMode                           ;0x007c357a :        8b3504719100
             pushd 08001h                                                    ;0x007c3580 :        6801800000
             call SetErrorMode
             push  dword ptr [edi]                                           ;0x007c3587 :        ff37
             mov ebx , eax                                                   ;0x007c3589 :        8bd8
             call  LoadLibraryA                                ;0x007c358b :        ff157c719100
             push ebx                                                        ;0x007c3591 :        53
             mov  dword ptr [ ebp + 48 ] , eax                               ;0x007c3592 :        894530
             call SetErrorMode
             xor ebx , ebx                                                   ;0x007c3597 :        33db
             cmp  dword ptr [ ebp + 48 ] , ebx                               ;0x007c3599 :        395d30
             mov esi , 02B3h                                                 ;0x007c359c :        beb3020000
             jne Label7c35f1                                                 ;0x007c35a1 :        754e

     Label7c35a3 ::
             mov ecx , edi                                                   ;0x007c35a3 :        8bcf
             call Fun42c1e2                                                  ;0x007c35a5 :        e8388cc6ff


     ;
     ;                 ----------------------------------------------------------------
     ;                      VFP 9.0 FIX - USE SET LIBRARY TO OPEN A PROCEDURE FILE
     ;                                  July 2026
     ;                 ----------------------------------------------------------------
     ;                                     CCB
     ;
     ; Use SET LIBRARY to open a procedure file.
     ;
     ; 2026/7/17, by ccb
     ;

             cmp dword ptr vfpa_sys9208_data,00h
             jne Label7c35aa
             jmp Label7c35df


     Label7c35aa ::
             cmp  dword ptr [ ebp + 025Ch ] , ebx                            ;0x007c35aa :        399d5c020000
             je Label7c35df                                                  ;0x007c35b0 :        742d

     Label7c35b2 ::
             mov  ecx , dword ptr [ ebp + 0258h ]                            ;0x007c35b2 :        8b8d58020000
             call Fun54c1b5                                                  ;0x007c35b8 :        e8f88bd8ff
             test eax , eax                                                  ;0x007c35bd :        85c0
             mov dword ptr [ Data93c2e4 ] ,  eax                             ;0x007c35bf :        a3e4c29300
             je Label7c35d5                                                  ;0x007c35c4 :        740f
             xor ecx , ecx                                                   ;0x007c35c6 :        33c9
             inc ecx                                                         ;0x007c35c8 :        41
             mov edx , eax                                                   ;0x007c35c9 :        8bd0
             call Fun527a73                                                  ;0x007c35cb :        e8a344d6ff
             jmp Label7c3758                                                 ;0x007c35d0 :        e983010000

     Label7c35d5 ::
             mov ecx , 02D6h                                                 ;0x007c35d5 :        b9d6020000
             jmp Label7c3753                                                 ;0x007c35da :        e974010000

     Label7c35df ::
             lea ecx ,  dword ptr [ ebp + 013Ch ]                            ;0x007c35df :        8d8d3c010000
             call Fun44d338                                                  ;0x007c35e5 :        e84e9dc8ff
             mov ecx , esi                                                   ;0x007c35ea :        8bce
             call Fun544742                                                  ;0x007c35ec :        e85111d8ff

     Label7c35f1 ::
             mov ecx , edi                                                   ;0x007c35f1 :        8bcf
             call Fun42c1e2                                                  ;0x007c35f3 :        e8ea8bc6ff
             pushd offset Data929bd0                                                  ;0x007c35f8 :        68d09b9200
             push  dword ptr [ ebp + 48 ]                                    ;0x007c35fd :        ff7530
             call  GetProcAddress                              ;0x007c3600 :        ff1524729100
             cmp rax , 0                                                   ;0x007c3606 :        3bc3
             mov  dword ptr [ ebp + 40 ] , eax                               ;0x007c3608 :        894528
             jne Label7c3628                                                 ;0x007c360b :        751b
             push  dword ptr [ ebp + 48 ]                                    ;0x007c360d :        ff7530
             call  FreeLibrary                                 ;0x007c3610 :        ff1580719100
             lea ecx ,  dword ptr [ ebp + 013Ch ]                            ;0x007c3616 :        8d8d3c010000
             call Fun44d338                                                  ;0x007c361c :        e8179dc8ff
             mov ecx , esi                                                   ;0x007c3621 :        8bce
             call Fun544742                                                  ;0x007c3623 :        e81a11d8ff

     Label7c3628 ::
             cmp  dword ptr [ Data947660 ] , ebx                             ;0x007c3628 :        391d60769400
             jne Label7c3675                                                 ;0x007c362e :        7545
             lea edx ,  dword ptr [ ebp + 44 ]                               ;0x007c3630 :        8d552c
             lea eax ,  dword ptr [ ebp + 0FFFFFF78h ]                       ;0x007c3633 :        8d8578ffffff
             call Fun42c27f                                                  ;0x007c3639 :        e8418cc6ff
             push ebx                                                        ;0x007c363e :        53
             push eax                                                        ;0x007c363f :        50
             call Fun42c2be                                                  ;0x007c3640 :        e8798cc6ff
             mov esi , eax                                                   ;0x007c3645 :        8bf0
             cmp esi , ebx                                                   ;0x007c3647 :        3bf3
             pop ecx                                                         ;0x007c3649 :        59
             pop ecx                                                         ;0x007c364a :        59
             jne Label7c3652                                                 ;0x007c364b :        7505
             call Fun7c37b1                                                  ;0x007c364d :        e85f010000

     Label7c3652 ::
             lea eax ,  dword ptr [ ebp + 44 ]                               ;0x007c3652 :        8d452c
             push eax                                                        ;0x007c3655 :        50
             lea eax ,  dword ptr [ ebp + 0FFFFFF78h ]                       ;0x007c3656 :        8d8578ffffff
             call Fun42d200                                                  ;0x007c365c :        e89f9bc6ff
             cmp esi , ebx                                                   ;0x007c3661 :        3bf3
             je Label7c3675                                                  ;0x007c3663 :        7410
             push  dword ptr [ ebp + 48 ]                                    ;0x007c3665 :        ff7530
             call  FreeLibrary                                 ;0x007c3668 :        ff1580719100
             mov ecx , esi                                                   ;0x007c366e :        8bce
             call Fun544742                                                  ;0x007c3670 :        e8cd10d8ff

     Label7c3675 ::
             mov eax ,  dword ptr [ Data941124 ]                             ;0x007c3675 :        a124119400
             push  dword ptr [ ebp + 40 ]                                    ;0x007c367a :        ff7528
             lea ecx ,  dword ptr [ eax + 03E8h ]                            ;0x007c367d :        8d88e8030000
             mov  dword ptr [eax] , ecx                                      ;0x007c3683 :        8908
             lea ecx ,  dword ptr [ eax + 013ECh ]                           ;0x007c3685 :        8d88ec130000
             xor edx , edx                                                   ;0x007c368b :        33d2
             mov  dword ptr [ eax + 4 ] , ecx                                ;0x007c368d :        894804
             mov  dword ptr [ eax + 24 ] , offset Label65cc4c                          ;0x007c3690 :        c740184ccc6500
             mov  dword ptr [ eax + 16 ] , ebx                               ;0x007c3697 :        895810
             call Fun65cb76                                                  ;0x007c369a :        e8d794e9ff
             mov eax ,  dword ptr [ Data941124 ]                             ;0x007c369f :        a124119400
             cmp  dword ptr [ eax + 4 ] , 01388h                             ;0x007c36a4 :        81780488130000
             je Label7c36c0                                                  ;0x007c36ab :        7413
             push  dword ptr [ ebp + 48 ]                                    ;0x007c36ad :        ff7530
             call  FreeLibrary                                 ;0x007c36b0 :        ff1580719100
             mov ecx , 02C7h                                                 ;0x007c36b6 :        b9c7020000
             call Fun544742                                                  ;0x007c36bb :        e88210d8ff

     Label7c36c0 ::
             mov eax ,  dword ptr [ Data941124 ]                             ;0x007c36c0 :        a124119400
             mov  eax , dword ptr [eax]                                      ;0x007c36c5 :        8b00
             mov  dword ptr [ ebp + 32 ] , eax                               ;0x007c36c7 :        894520
             lea edx ,  dword ptr [ ebp + 28 ]                               ;0x007c36ca :        8d551c
             lea eax ,  dword ptr [ ebp - 56 ]                               ;0x007c36cd :        8d45c8
             call Fun42c27f                                                  ;0x007c36d0 :        e8aa8bc6ff
             push ebx                                                        ;0x007c36d5 :        53
             push eax                                                        ;0x007c36d6 :        50
             call Fun42c2be                                                  ;0x007c36d7 :        e8e28bc6ff
             cmp eax , ebx                                                   ;0x007c36dc :        3bc3
             pop ecx                                                         ;0x007c36de :        59
             pop ecx                                                         ;0x007c36df :        59
             mov  dword ptr [ ebp + 36 ] , eax                               ;0x007c36e0 :        894524
             jne Label7c3736                                                 ;0x007c36e3 :        7551
             mov  edi , dword ptr [ ebp + 32 ]                               ;0x007c36e5 :        8b7d20
             cmp  word ptr [ edi + 4 ] , bx                                  ;0x007c36e8 :        66395f04
             mov  eax , dword ptr [ edi + 6 ]                                ;0x007c36ec :        8b4706
             mov  dword ptr [ ebp + 44 ] , ebx                               ;0x007c36ef :        895d2c
             jle Label7c371d                                                 ;0x007c36f2 :        7e29
             lea ebx ,  dword ptr [ eax + 4 ]                                ;0x007c36f4 :        8d5804

     Label7c36f7 ::
             cmp  word ptr [ ebx + 4 ] , 0FFFFFFFEh                          ;0x007c36f7 :        66837b04fe
             jne Label7c370c                                                 ;0x007c36fc :        750e
             pushd 00h                                                       ;0x007c36fe :        6a00
             push  dword ptr [ ebp + 40 ]                                    ;0x007c3700 :        ff7528
             xor esi , esi                                                   ;0x007c3703 :        33f6
             push  dword ptr [ebx]                                           ;0x007c3705 :        ff33
             call Fun65cbf2                                                  ;0x007c3707 :        e8e694e9ff

     Label7c370c ::
             movsx eax ,word ptr [ edi + 4 ]                                 ;0x007c370c :        0fbf4704
             inc  dword ptr [ ebp + 44 ]                                     ;0x007c3710 :        ff452c
             add ebx , 0Eh                                                   ;0x007c3713 :        83c30e
             cmp  dword ptr [ ebp + 44 ] , eax                               ;0x007c3716 :        39452c
             jl Label7c36f7                                                  ;0x007c3719 :        7cdc
             xor ebx , ebx                                                   ;0x007c371b :        33db

     Label7c371d ::
             push  dword ptr [ ebp + 40 ]                                    ;0x007c371d :        ff7528
             mov  esi , dword ptr [ ebp + 0254h ]                            ;0x007c3720 :        8bb554020000
             push  dword ptr [ ebp + 48 ]                                    ;0x007c3726 :        ff7530
             lea eax ,  dword ptr [ ebp + 013Ch ]                            ;0x007c3729 :        8d853c010000
             push edi                                                        ;0x007c372f :        57
             push eax                                                        ;0x007c3730 :        50
             call Fun7c37f3                                                  ;0x007c3731 :        e8bd000000

     Label7c3736 ::
             lea eax ,  dword ptr [ ebp + 28 ]                               ;0x007c3736 :        8d451c
             push eax                                                        ;0x007c3739 :        50
             lea eax ,  dword ptr [ ebp - 56 ]                               ;0x007c373a :        8d45c8
             call Fun42d200                                                  ;0x007c373d :        e8be9ac6ff
             cmp  dword ptr [ ebp + 36 ] , ebx                               ;0x007c3742 :        395d24
             je Label7c3758                                                  ;0x007c3745 :        7411
             push  dword ptr [ ebp + 48 ]                                    ;0x007c3747 :        ff7530
             call  FreeLibrary                                 ;0x007c374a :        ff1580719100
             mov  ecx , dword ptr [ ebp + 36 ]                               ;0x007c3750 :        8b4d24

     Label7c3753 ::
             call Fun544742                                                  ;0x007c3753 :        e8ea0fd8ff

     Label7c3758 ::
             mov  ecx , dword ptr [ ebp + 0248h ]                            ;0x007c3758 :        8b8d48020000
             call Fun42bf1d                                                  ;0x007c375e :        e8ba87c6ff
             pop edi                                                         ;0x007c3763 :        5f
             pop esi                                                         ;0x007c3764 :        5e
             pop ebx                                                         ;0x007c3765 :        5b
             add ebp , 024Ch                                                 ;0x007c3766 :        81c54c020000
             leave                                                           ;0x007c376c :        c9
             ret 0Ch                                                         ;0x007c376d :        c20c00


4. APPLIES TO:

     VFP 6.0.8167.0
     VFP 6.0.8961.0 (SP5)

     VFP 7.0.0.9262
     VFP 7.0.0.9465 (SP1)

     VFP 8.0.0.2521
     VFP 8.0.0.3117 (SP1)

     VFP 9.0.0.2412
     VFP 9.0.0.3504 (SP1)
     VFP 9.0.0.4611 (SP2)
     VFP 9.0.0.5015 (SP2)
     VFP 9.0.0.5411 (SP2)
     VFP 9.0.0.5721 (SP2)
     VFP 9.0.0.5815 (SP2)
     VFP 9.0.0.6303 (SP2)
     VFP 9.0.0.6602 (SP2)
     VFP 9.0.0.7423 (SP2)

     The bug has been fixed in VFP Advanced.


5. REFERENCE WEBSITES:

     1, baiyujia.com:
     http://www.baiyujia.com
     http://www.baiyujia.com/vfpdocuments/f_vfp9fix417.asp


6. OTHER:

     For reference only, there is no guarantees.

     Any questions or suggestions, please send me an email at ccb2000@163.com.