File in the network not updating in vb6 - vb6

I built software which can run from the network system. If the software which is on the network is run then the software will run as portable app.
When i run the remote application the software will write the log in the remote system itself. There is no error found when writing the log and accessing the log, but the problem is when the log file opened with the any text editors the written data from the application will not be seen in the file but as i said before data can be accessed from coding.
In the coding simple file write method is used to write the stream of data. The strange thing is if i give the permission to EVERYONE for the log file then the problem will be solved and the log file will be updated when opened the log file in the text editors.
Now my question is if the file did not have the permission then why there was no error in the application when writing? Why i am able to access the written data from coding and why not in text editors?
System OS: Windows 10
Text editor used: Notepad, Notepad++, wordpad
Update:
Code used to write the log is
Open "test.LOG" For Random Access Read Write Lock Write As #i Len = 500
Put #i, record, logstring

Related

Get windows Log

I received a windows application that is create a file on my windows. How can I find out where the file is?
I guess the program create a text file to save a code or something. I want that file. What can I do and how can I find it?
Sorry for bad English.
You can use Process Monitor to monitor any changes to file system or registry a program makes. Filter for the name of your programs executable and for file creation. Then run your program and analyze the log. Be prepared there might be a lot of entries.
Also keep in mind that "codes" are often not just stored in files. It might be in the registry and it might not be in the format you expect...

Concurrent File read write

I'm on a Win7 platform, I have a third party software that opens and writes to a given file. I would like to intercept the data going into that file and view it, before the process finishes. While the file is being filled, it is visibly getting bigger in explorer, so the data is being written IMO. Of course, any attempt (using any high- or low-level api I know of, writing in Python if it makes any difference) results in an" access is denied" error 5 or "The process cannot access the file because it is being used by another process." error 32.
What am I missing?
You cannot access the file unless the other app allows it. When it opens/creates the file, it specifies sharing rights for the file. If you try to open the file while it is already open, using flags that are not compatible with the sharing rights, your open will fail. If you want to open the file for read-only access, the other app must open/create the file with read sharing enabled. You can use a tool like SysInternals Process Monitor to see what sharing rights the other app is actually using.

Is it possible to recover a running VBScript file, if the original file was already deleted?

I have one Vbscript which runs continuously on my system to monitor a web page on Internet Explorer.
I have permanently deleted this Vbscript file from its original location on system by mistake, However the script is still in RAM and is still running and monitoring the web page.
This script is very important to me but I have lost it :(
I want to know if there is any way by which I can recover the code of Vbscript file from system's RAM or any temporary file as the script is still running.
I am not allowed to use any file recovery software, so please don't suggest to install any third party data recovery software.
Try using 'ADPlus.vbs' script from WinDbg:
1. http://msdn.microsoft.com/en-us/windows/hardware/hh852365
2. http://support.microsoft.com/kb/286350
As the code was running, I followed the below process to recover the running code:
Go to Task Manager
Select the process and create dump
Open online dump analyser (www.osronline.com)
Upload dump file
Download the dump analysis
The dump analysis provided almost 95% of the correct code. Code within some loops were distorted or changed. As I was the owner of the code I was able to correct it.
Use HxD, it can view all ram content relative to any process at fly. It is commonly used to hack currently running games etc.
After locating your script, it might be needed to clear alphanumeric mess between your code, N++ and regex knowledge may be useful.

VB6/MS Access unusual behaviour with saved records

I have a VB6 application and it links to a MS Access DB. All records on a data entry screen are written or read using ADO/SQL.
At one user site, (using Win 7 - his UAC was set to the maximum security so to start with, there were errors reading/writing galore! Furthermore the app and Data (sub-folder) folder was set to only read. So once I corrected all of this by changing Security for "All User" to FULL CONTROL, the records were written to the DB. However when I open the MDB from MS Access directly I was unable to see ANY records in any of the 3 tables where the Client entered data from the front end.
So
1. either MS Access is hiding the rows in the table with data and display and blank table or
2. there is a hidden copy of the MDB in the Data sub-folder (as the program check the availability of the MDB file when it starts and if unavailable it posts a Message Box error
Has anyone seen this behaviour and if it is #2, how do I in Win 7 show all files - bear in mind that MDBs are not operating system files so by default should not be hidden. OR is this some AV (Symantec) activity?
Please see this link from Y 2004 which is exactly like my issue - but there was no answer:
http://www.pcreview.co.uk/forums/hidden-records-t1086918.html
Appreciate any help anyone can shed
Regards
Fonz
This sounds like an improperly designed application that puts writable data (an MDB file here) within a protected folder ("Program Files") and is being run with no application manifest stating that it is "Vista aware." If you do this Windows will try to fit a standard set of appcompat shims to the program, and in this case most likely the file virtualization shim is at work.
This results in each user creating private copies of the orginal data within their Virtual Store folder. These private copies are what gets updated.
A proper manifest would result in a fatal runtime error on this security violation instead, making it quicker to understand what is being done wrong and generally leading to a faster resolution.
Things such as INI files, MDB files, and other application resources that must be updated and available to any user of the system should be put into an application-specific folder your installer creates under [CommonAppData]. You installer should set the desired security attributes on the subfolder to contain writable files so that all users have the desired access. The default here is "owner" access which probably is not what you would want (file creator has full access, others have read access).
This works on any version of Windows including Windows 95 with the IE4 Desktop Update. It is fairly easy to accomplish via Installer MSI packages.
Are you 100% certain about which MDB file is being written to? If you are writing then seeing your records in the VB6 but then can't see them in the MDB that you open, it's possible that it's doing it to a different file.
I suggest you use process monitor to verify exactly which file is being written to by the VB6 app. That will allow you to troubleshoot further.
http://technet.microsoft.com/en-us/sysinternals/bb896645
It can be a little busy but it will let you establish exactly which file is being written to regardless of any asuumptions you make about the operation of your code.

Cause of file open error with _lopen because of unexpected file lock

I'm maintaining a desktop application that accesses data on servers. Multiple users can access the same files. We have a library that opens the files for retrieval using _lopen (C library function). We always open read only with SHARE_DENY_NONE.
To improve performance, we keep the file open until the user exits the application. That is when the file is closed.
However, if there is no activity for over 20 minutes, we will lose the connection to the server. In that case we start the connection and open the file again. Supposedly there is a file close operation called when the connection is lost, but there is no proof that the file close is called.
Unfortunately, once or twice a day users get an error message that they are unable to open a file. We think this is because the file is locked, because we can't open it in explorer either. The only way to clear the error is to call IISRESET so that all the file handles for retrieval are cleared. However, today we got the error message which is a generic file open error, and we were able to open the file in explorer and also clear the problem by recycling the app pool.
Because some users get the file open error as soon as they start the application before they have done anything, we think that this problem must be caused by some other user (or process) locking the file. We are unable to replicate the error.
I have reviewed the source code to see how the file is opened. I have reviewed Process Explorer and the file is always accessed by our software. I have reviewed process monitor and seen that the file is opened permitting read/write operations by other users, and that the file is closed when the application closes. We never get the error on our development servers, but only on the production servers. The error doesn't depend on large numbers of users, because we can't replicate it using a test program that opens the file 1000 times with 1000 different users. Also, we have seen the error with only 9 users.
I hope someone can suggest additional tests to try or additional reasons this problem might occur.

Resources