Encrypted TPS Files in Clarion 11

We have begun testing on a suite of tools that have been converted from C6.3 to C11. We have seven TPS files that are encrypted for SOX compliance. When I attempt to start the C11 application, the application attempts to open the SOXUser file and eventually crashes. When I attempt to open the file with TopScan, I get : Invalid Data File. If I press the okay button, it pops an entry form that allows me to supply the password and then opens the file.

Has anyone encountered this before and, if so, what is the solution?

If the password is defined within the actual FILE structure it can cause problems since it’s evident by opening the EXE or DLL - it’s displayed in plain text. A better way is to use a variable and obfuscate the actual password buried in a bunch of equates. The data for the equates will be in displayable code but if broken down and stuff within pointless strings it makes it harder to find.

If you are using a variable make certain it is filled prior to opening any files.

TopScan has worked that way for me with Password protected files. Capture below of file I know has password.

TopScan cannot import the structure of the table UNNAMED of Xxxxx.TPS
Error: Invalid Data File

I think the UNNAMED is because TPS can be a SuperFile so if it only has one file it is called UNNAMED.

Can you elaborate on that? What transpires? What error messages?

When starting the application, no error is presented to the end user. By using DebugViewer, I can see that it goes into a loop where it keeps trying to open the SOXUser file, which is password encrypted in the dictionary. This is the user file definition:


I have two virtual machines to do my development work: a Windows 7 Pro with C6.3; and, a Windows 11 with C11. We have a development file server which has the data on it. When I open the application or run TopScan on the 6.3 box all’s well; the C11 box doesn’t work.

In the C11 environment, when I try to open it with TopScan, I get the following:


Pressing the ‘OK’ button gives me this:

If I supply the correct password at this point, it opens the file as normal.

Hi Steve,
I’d take a step back and create a very simple project in C11 that just opens and reads this file. Copy the file definition from you data dll clw file to the project.
I tested an encrypted TPS file from a C6 project in both C11 and C11.1 and was able to open and read a record.
Here’s my little test program. Doing this will eliminate any issues other than the C11 driver.
Copy the TPS locally first to the project folder.
If that works, try opening it on the E: drive.
If that works, then go back to your main program and start adding debug code to figure out why it doesn’t work.


  PROGRAM
                              MAP
                              END
  include('ERRORS.CLW'), once
  include('ABFILE.EQU'), once

SystemFile                    FILE,DRIVER('TOPSPEED'),OWNER('$$$$$$$$$),ENCRYPT,NAME('CompInfo'),PRE(SYS),CREATE,BINDABLE,THREAD !System Information  
Record                          RECORD,PRE()
FileOwnerValue                    CSTRING(21)                    !                    
SYSID                             CSTRING(7)                     !System Specific Unique Identifier
SystemUnique                      CSTRING(17)                    !Unique of this computers System table record
                                END
                              END   
  CODE

  OPEN(SystemFile,ReadOnly+DenyNone) 
  if ERRORCODE()
    MESSAGE('Error opening file: ' & choose(errorcode()=FileSystemErr, fileerror(), error()))
  else
    set(SystemFile)
    next(SystemFile)
    MESSAGE('No errors: ' & SYS:SystemUnique)
  end
  close(SystemFile)
  return
  

Is this a multi-DLL app?

ABC?

If so, the “global” app is the one that actually opens the file. Has it been compiled with the current state of your dictionary, along with the rest of the DLL apps?

JAT

Rick: I used your snippet above to test and it ran fine (minor tweaks). I then cut and pasted the data DLL’s defintion for the table and modified your code to support it thusly:

PROGRAM
MAP
END
include(‘ERRORS.CLW’), once
include(‘ABFILE.EQU’), once

SOXUser FILE,DRIVER(‘TOPSPEED’),OWNER(‘’),ENCRYPT,NAME(‘SXUser.TPS’),PRE(User),BINDABLE,THREAD ! Users that will be given access to system areas with various access rights and privileges
IdKey KEY(User:SOXUserId),NOCASE,OPT,PRIMARY ! Primary Index - Unique
LoginNameKey KEY(User:UserLoginName),NOCASE,OPT ! by Login
PassCodeKey KEY(User:UserCode),NOCASE,OPT ! by Password Initials
NameKey KEY(User:LastName,User:FirstName),DUP,NOCASE,OPT ! by Last, First name
Record RECORD,PRE()
SOXUserId LONG ! Unique Row identifier used to manage a row and relate a row’s content to other tables.
UserLoginName STRING(30) ! Contains the Login Name used by the user - corresponds to Active Directory name
UserActive BYTE ! Determines if the User is Active or not (0 = In Active; 1 = Active)
PasswordId LONG ! Unique Identifier pointing to the related PASSWORD table entry that corresponds to this user
UserCode STRING(3) ! Short hand code for User that is recorded in several tables to indicate who did something (Same as the Code in the PASSWORD table)
FirstName STRING(20) ! Persons First Name
LastName STRING(40) ! Persons Last name
MiddleName STRING(20) ! Persons middle name (or initial)
END
END

CODE
    SETPATH('E:\SIMDATA')
    OPEN(SOXUser,ReadOnly+DenyNone) 
    if ERRORCODE()
        MESSAGE('Error opening file: ' & choose(errorcode()=FileSystemErr, fileerror(), error()))
    else
        set(SOXUser)
        next(SOXUser)
        MESSAGE('No errors: ' & User:UserLoginName)
    end
    close(SOXUser)
    return

This compiled and executed fine.

Jeff: It is a multi-DLL app and the data DLL contains all file definitions. All of the applications in the solution compile without any errors.

I may possibly need to ditch the current procedure and redo them from scratch. Still a head scratcher, though…

Thanks guys, at least I know I’m not insane (perhaps, somewhat deranged…)

Steve

1 Like

FYI: Off topic here, but my understanding is that OPT is not valid in conjunction with PRIMARY key

Well at least you know it’s something/somewhere in your code. :slight_smile:

Make sure you test opening it readwrite+denynone, too.

Are you setting the OWNER value at run-time, or directly within the file definition?

Are you compiling in release, or debug mode?

If in release mode, does it change anything if you switch to debug mode and recompile the apps?

If that does “fix” the problem, it could be possible that “debug” embeds were used to set the OWNER at run time.

I think the post-c6 IDEs could be more aggressive at hiding code located in DEBUG embeds when in release mode. Or at least it seemed that way to me.

Just a wild guess based on something that happened to me.

2 Likes

I was able to isolate the issue to a procedure (SETFILE) we have that opens files with whichever driver is appropriate. The one that handles the flat files (.TPS, .DAT, .CSV, etc.) works fine in 6.3 but does not work in 11.1. After running Rick’s sample and being successful opening the file, I modified the production code to use the same method as Rick’s script. It worked like a champ.
Don’t know what’s wrong with the original procedure; but, the solution was quick and easy to change.

Thanks to everyone that offered help.

Steve

Clarion’s backward compatibility is phenomenal, but not perfect :slight_smile:

1 Like