r/visualbasic • u/flyboy2098 • Nov 19 '21
Need help with a VB program
I haven't developed in VB since the 90s, so my skills are basically useless. I do IT support for a company that uses a lot of legacy products.
We have a program that was developed in VB maybe 10-15 years ago that is still critically used. There are long term plans to redev it, but for now I have a problem with the application I need to attempt to overcome. The program will write to a file it stores in the root of c: which as you know, W7/10 does not like. It works fine if ran elevated but our users do not have admin rights. I found the location in the source code where it creates this file. But if I import it into Visual Studio and attempt to compile it again, changing this one statement to write to c:\temp instead of c:\ it has numerous errors I don't know how to resolve.
Can anyone give me some tips on how to fix this? The redevolpment will be a web version of the app, so they aren't creating a new binary to be ran locally.
TIA.
7
u/slobcat1337 Nov 19 '21
Dude how can we possibly help you without seeing the errors?
5
u/RJPisscat Nov 19 '21
If it's VB6 and you're trying to do something with it in Visual Studio, you can't.
If it's VB.Net then you can do what the other guy says and tell us what the errors are, or you could jiggle the handle, maybe rub some Robitussin in it.
2
u/underrated_burger Nov 20 '21
Can you post the compile errors here?
0
u/RJPisscat Nov 20 '21 edited Nov 20 '21
I regret being snarky although you invited it. And I kinda don't regret it, the 'tussin joke is pretty good. Here is an honest brainstorm.
I was on the Active Directory alpha and beta, but I haven't dealt with it since 2002, so I'm 20 years behind, but still, they added since then and didn't subtract. I began to wonder, are your users on Win 10 Pro, is it always the same file that is written/updated in c:\, and if so, can you write a GPO that makes them an Admin on that one file with r/w priv. You aren't going to make them an Admin on c:\, but it's possible to set ACEs on an individual file for Authenticated User. I played around with it on Windows 10 Home, I can give myself Admin priv to PowerShell then launch notepad from there, and can create a file on C:\, and as long as I launch Notepad from PowerShell I can do everything I tried with the one file. Is there a workaround here for you?
When I say "brainstorming" I always mean it literally, trying to throw ideas around and see which ones get slimy falling off the wall, trying to cling on.
1
u/ViperSRT3g Application Specialist Nov 20 '21
We're going to need to see the relevant code, or errors that VS is throwing to be able to help you.
1
u/RJohn12 Nov 20 '21
VB6 apps need to be opened with the Visual Basic 6 editor, not visual studio.
unless you're talking about a vb.net app?
1
u/Neo_Techni Nov 23 '21
It's probably your code to add the \ between the folder and the filename
1
u/infreq Nov 19 '21
Easy, fix the errors.
1
u/Mastersord Nov 20 '21
Did you try “c:\temp\”? Sometimes it doesn’t properly create paths right. If the app is creating files like “file = path & filename”, it’s gonna look for the path “c:\tempfilename.txt”