I have a COBOL exe program which calls a COBOL dll which in turn calls a COBOL program using a dos interrupt 'x91 - the calling program uses an 'x91' to activate an EXE file as if it were typed in as an operating system command line entry. The security program which wraps my cobol code is a third party program which wraps around my program. The author has suggested that my program read environment variables to insure that the security has not been hacked. I have been unable to get my cobol to read the variables, so I thought that writing the program in C, the variables could be read. All the present program does is create a small sequential file, write one record to it and close the file - for security, I have the program wrapped by third party security software, and it generates the variables I want to verify to allow the progam to write the record weith the contents of the security check as passed or not passed. the calling program (a cobol dll) then tests for the presence of the file, reads the record and validates whether the code for security has been written into the file.
我有一个COBOL exe程序调用COBOL dll,后者又使用dos中断'x91调用COBOL程序 - 调用程序使用'x91'激活EXE文件,就好像它是作为操作系统命令行键入的一样条目。包装我的cobol代码的安全程序是第三方程序,它包含了我的程序。作者建议我的程序读取环境变量以确保安全性没有被黑客入侵。我一直无法让我的cobol读取变量,所以我认为用C编写程序,可以读取变量。所有现在的程序都是创建一个小的顺序文件,写一个记录并关闭文件 - 为了安全起见,我将程序包装在第三方安全软件中,并生成我想要验证的变量以允许程序进行写入记录,将安全检查的内容传递给或不传递。然后,调用程序(cobol dll)测试文件是否存在,读取记录并验证安全性代码是否已写入文件。
The COBOL program needs to be translated to C++ because the author of the security wrapping code says he can't interface with cobol executables.
COBOL程序需要转换为C ++,因为安全包装代码的作者说他无法与cobol可执行文件连接。
- The present program is small
- All it does is create a small sequential flat text file, write one record to it, and then write the record and close the file.
- The program needs to check for the presence and value of certain "environment" variables being generated by a security program which wraps around the little program generating the file, and runs while the wrapped program is running.
目前的方案很小
它所做的只是创建一个小的顺序平面文本文件,写一个记录,然后写入记录并关闭文件。
程序需要检查由安全程序生成的某些“环境”变量的存在和值,该程序包装生成文件的小程序,并在包装程序运行时运行。
For example, the variable "LICENSE" Returns the name of the current license used. thanks for any input.
例如,变量“LICENSE”返回当前使用的许可证的名称。感谢任何输入。
The author of the security software has been unable to provide a small executable to check his variables, so I am looking to create one from scratch which will emulate the little cobol program I have been referring to (read the environment variables of the security program wrapping and securing my little program, create a file, write one record to it, the contents of which depend on the environment variable's values, and then close the file). In this way, the calling DLL will receive the file written by the small program executed by 'x91' call to the operating system (the one which needs to be coded in C++ instead of the present Cobol), verify its contents, and either allow the main program to procede or not. The main software consists of over 500 programs which I have ported from mainframe legacy code to PC. I used to use dongles but my clients hated them as they interferred with their printers...
安全软件的作者无法提供一个小的可执行文件来检查他的变量,所以我期待从头开始创建一个将模拟我所指的小cobol程序(读取安全程序包装的环境变量)并保护我的小程序,创建一个文件,写一个记录,其内容取决于环境变量的值,然后关闭文件)。这样,调用DLL将接收由'x91'调用执行的小程序写入的文件到操作系统(需要用C ++而不是现在的Cobol编码),验证其内容,并允许是否进行的主要计划。主要软件包含500多个程序,我已将这些程序从大型机遗留代码移植到PC。我曾经使用加密狗,但我的客户讨厌他们,因为他们干扰他们的打印机......
the DOS call which activates the new little wrapped program will work with any executable program so it really is not an issue..
激活新的小包装程序的DOS调用将适用于任何可执行程序,因此它确实不是问题。
3 个解决方案
#1
I know nothing about COBOL, but there are pretty clear instructions for using it to read Windows environment variables here.
我对COBOL一无所知,但是在这里使用它来读取Windows环境变量有很明确的说明。
After looking over that, I am glad I don't know anything about COBOL.
看了之后,我很高兴我对COBOL一无所知。
#2
As we don't all speak COBOL here, and that the code is reasonably small, it will probably be in your best interests to write some pseudo-code that explains what the COBOL does.
由于我们不是都在这里说COBOL,并且代码相当小,因此编写一些解释COBOL功能的伪代码可能符合您的最佳利益。
I could probably find a one-liner in Perl that'd do exactly what you want, but at present, I don't know exactly what you do want, so I can't help you.( Even if you did want a Perl-one-liner ;) )
我可能会在Perl中找到一个完全符合你想要的内容,但是目前我还不知道你到底想要什么,所以我无法帮助你。(即使你确实想要一个Perl) -one-liner;))
#3
Some points:
- I really don't think your code is being executed by a "DOS interrupt" as you can't use those with Windows, which your question implies you are using. BTW, please add SO tags to indicate this.
- You say that it can't read environment variables, but that the calling application (written in the same language) can create them? This doesn't seem likely either.
- Where in the code do you want to read the environment variable & what do you want to with it?
我真的不认为你的代码是由“DOS中断”执行的,因为你不能使用Windows,你的问题暗示你正在使用它。顺便说一句,请添加SO标签来表明这一点。
你说它无法读取环境变量,但调用应用程序(用同一种语言编写)可以创建它们吗?这似乎也不太可能。
在代码中你想要读取环境变量以及你想用它做什么?
As a quick solution, I suggest having the wrapping code write the environment variable values out to a file and then read that. If you really want a C or C++ solution, you will have to clarify your question.
作为一个快速的解决方案,我建议让包装代码将环境变量值写入文件然后读取。如果您真的需要C或C ++解决方案,则必须澄清您的问题。
Edit: Please note that * is a site for answering programming questions - it is not a site to provide you with free software. If the problem is as easy as you say it is (and requires a C solution, something I am still not convinced of), hire a C programmer for half a day to write it.
编辑:请注意*是一个回答编程问题的网站 - 它不是一个为您提供免费软件的网站。如果问题就像你说的那么容易(并且需要C解决方案,我仍然不相信),请雇用C程序员半天来编写它。
#1
I know nothing about COBOL, but there are pretty clear instructions for using it to read Windows environment variables here.
我对COBOL一无所知,但是在这里使用它来读取Windows环境变量有很明确的说明。
After looking over that, I am glad I don't know anything about COBOL.
看了之后,我很高兴我对COBOL一无所知。
#2
As we don't all speak COBOL here, and that the code is reasonably small, it will probably be in your best interests to write some pseudo-code that explains what the COBOL does.
由于我们不是都在这里说COBOL,并且代码相当小,因此编写一些解释COBOL功能的伪代码可能符合您的最佳利益。
I could probably find a one-liner in Perl that'd do exactly what you want, but at present, I don't know exactly what you do want, so I can't help you.( Even if you did want a Perl-one-liner ;) )
我可能会在Perl中找到一个完全符合你想要的内容,但是目前我还不知道你到底想要什么,所以我无法帮助你。(即使你确实想要一个Perl) -one-liner;))
#3
Some points:
- I really don't think your code is being executed by a "DOS interrupt" as you can't use those with Windows, which your question implies you are using. BTW, please add SO tags to indicate this.
- You say that it can't read environment variables, but that the calling application (written in the same language) can create them? This doesn't seem likely either.
- Where in the code do you want to read the environment variable & what do you want to with it?
我真的不认为你的代码是由“DOS中断”执行的,因为你不能使用Windows,你的问题暗示你正在使用它。顺便说一句,请添加SO标签来表明这一点。
你说它无法读取环境变量,但调用应用程序(用同一种语言编写)可以创建它们吗?这似乎也不太可能。
在代码中你想要读取环境变量以及你想用它做什么?
As a quick solution, I suggest having the wrapping code write the environment variable values out to a file and then read that. If you really want a C or C++ solution, you will have to clarify your question.
作为一个快速的解决方案,我建议让包装代码将环境变量值写入文件然后读取。如果您真的需要C或C ++解决方案,则必须澄清您的问题。
Edit: Please note that * is a site for answering programming questions - it is not a site to provide you with free software. If the problem is as easy as you say it is (and requires a C solution, something I am still not convinced of), hire a C programmer for half a day to write it.
编辑:请注意*是一个回答编程问题的网站 - 它不是一个为您提供免费软件的网站。如果问题就像你说的那么容易(并且需要C解决方案,我仍然不相信),请雇用C程序员半天来编写它。