Click here to Skip to main content
15,886,919 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
QuestionMVC ASP.NET AJAX ACTION LINK CREATE Pin
f1sher25-Jul-13 22:39
f1sher25-Jul-13 22:39 
SuggestionRe: MVC ASP.NET AJAX ACTION LINK CREATE Pin
Richard MacCutchan26-Jul-13 6:40
mveRichard MacCutchan26-Jul-13 6:40 
QuestionCan i watch events like renaming in my Webdav drive(Virtual drive) in C#.net Pin
Anish K S24-Jul-13 20:37
Anish K S24-Jul-13 20:37 
AnswerRe: Can i watch events like renaming in my Webdav drive(Virtual drive) in C#.net Pin
Dave Kreskowiak25-Jul-13 1:21
mveDave Kreskowiak25-Jul-13 1:21 
QuestionAdd user credentials to access server drive path from winforms in app.config vb.net Pin
hueikar21-Jul-13 16:26
hueikar21-Jul-13 16:26 
AnswerRe: Add user credentials to access server drive path from winforms in app.config vb.net Pin
Dave Kreskowiak22-Jul-13 1:49
mveDave Kreskowiak22-Jul-13 1:49 
AnswerRe: Add user credentials to access server drive path from winforms in app.config vb.net Pin
Eddy Vluggen22-Jul-13 3:17
professionalEddy Vluggen22-Jul-13 3:17 
QuestionStandalone .NET framework exe Pin
LostTime7720-Jul-13 6:26
LostTime7720-Jul-13 6:26 
Hello all, first time posting here.

At my workplace, we have a requirement to ship a program with as little button pressing as possible. The users on the other end are factory workers and it's well known that if you give them an option, they will misuse it. Anyhow.. the program is going to be written in .NET with WPF. We have to work under the assumption that the machines do not have .NET installed and they can't install it.

Now before I ask the question, which is more of a general "what if", please note, I am not interested in anything but what I am about to ask. For example "oh just install this", or "Oh, not possible". After doing many hours of research, what I ask IS in fact possible, because commercial programs do this (spoon studio, boxed app).

I am an advanced developer, so I know my way into some scary places in the Win32 API and also have been developing in .NET / Win32 / C++ for many years. My current job (past year) has been mainly with embedded C, so I am just getting back to Win32 stuff heavily.

So the subject of the question says it all. I want a standalone .NET exe in which the user does not have to install anything AND of which does not copy any temporary file to the file system. Using the commercial options (spoon studio / boxed app) are not possible, because they are not free, and this has to be a free solution for us.

So here is the meat of what I want to do. I want to make a CLR host that essentially calls into the mscoree.dll to host our .NET application pulling in all the dependencies that mscoree.dll needs. Where do these files come from if we cannot copy any temporary files you ask?: The Dll's are to be stored in the exe itself as resource files.

The Win32 loadlibrary function works only from files on the file system. However, after poking around with Win32 hooking, it has been discovered that LoadLibrary uses ZwOpenFile internally to get a handle to the file you pass in. ZwOpenFile can also not work with anything but a file system file that I am aware of.

Here is my idea. We hook ZwOpenFile using extended code overwriting. After disassembling NTDLL.dll, this is possible, because the prologue to the function is more than 5 bytes. Next, our custom function gets called. Thirdly, ZwOpenFile passes back a PHANDLE pointer to the opened file. How can we rejigger this PHANDLE pointer instead of using ZwOpenFile? How about CreateFile? Using CreateFile, you can pass in a named pipe. CreateFile returns a HANDLE pointer that I ASSume can be assigned to the ZwOpenFile PHANDLE parameter. I don't have a lot of experience with named pipes and what not, but this is just an idea. Maybe there is another way. Basically we get the dll file required by LoadLibrary from the resource stored in the exe originally. Using this block of memory, which is actually the dll itself, we can map it into something so that CreateFile gives us a handle that ZwOpenFile can pass back to LoadLibrary. Now, the big question is... is a file handle created with CreateFile 'compatible' with a PHANDLE that ZwOpenFile passes back. I am guessing that the structure is the same, BECAUSE I also tinkered with hooking the CreateFile API which uses ZwCreateFile internally. Thus, a PHANDLE from ZwCreateFile (which would give us a memory handle to the image instead of a required disk file) should be compatible with ZwOpenFile.

The mscoree.dll also requires some registry keys. I also looked at some registry key functions in a disassembler and it is also possible to hook these. However, I have not worked out the interaction of the registry keys and where they are used yet.

This is just my idea, but hopefully there are some constructive minds out there with more information on the subject. We really want the standalone .NET exe so that we can avoid writing a native Win32 program. PS, I am not interested in using anything other than .NET and WPF: no QT, no mono + GTK, no whatever, so please do not bring those options up.

I would treat this as more of a "what if" question besides trying to worry about what is happening with why I am asking the question.

Thanks
AnswerRe: Standalone .NET framework exe Pin
Dave Kreskowiak20-Jul-13 7:26
mveDave Kreskowiak20-Jul-13 7:26 
GeneralRe: Standalone .NET framework exe Pin
LostTime7620-Jul-13 8:01
LostTime7620-Jul-13 8:01 
GeneralRe: Standalone .NET framework exe Pin
LostTime7620-Jul-13 8:22
LostTime7620-Jul-13 8:22 
GeneralRe: Standalone .NET framework exe Pin
Dave Kreskowiak20-Jul-13 9:48
mveDave Kreskowiak20-Jul-13 9:48 
GeneralRe: Standalone .NET framework exe Pin
LostTime7620-Jul-13 10:26
LostTime7620-Jul-13 10:26 
GeneralRe: Standalone .NET framework exe Pin
Dave Kreskowiak20-Jul-13 10:36
mveDave Kreskowiak20-Jul-13 10:36 
GeneralRe: Standalone .NET framework exe Pin
LostTime7620-Jul-13 11:33
LostTime7620-Jul-13 11:33 
GeneralRe: Standalone .NET framework exe Pin
Dave Kreskowiak21-Jul-13 3:24
mveDave Kreskowiak21-Jul-13 3:24 
GeneralRe: Standalone .NET framework exe Pin
LostTime7621-Jul-13 5:33
LostTime7621-Jul-13 5:33 
GeneralRe: Standalone .NET framework exe Pin
Dave Kreskowiak21-Jul-13 6:03
mveDave Kreskowiak21-Jul-13 6:03 
GeneralRe: Standalone .NET framework exe Pin
LostTime7621-Jul-13 6:09
LostTime7621-Jul-13 6:09 
GeneralRe: Standalone .NET framework exe Pin
Dave Kreskowiak21-Jul-13 10:57
mveDave Kreskowiak21-Jul-13 10:57 
GeneralRe: Standalone .NET framework exe Pin
LostTime7621-Jul-13 13:32
LostTime7621-Jul-13 13:32 
GeneralRe: Standalone .NET framework exe Pin
Dave Kreskowiak21-Jul-13 14:53
mveDave Kreskowiak21-Jul-13 14:53 
GeneralRe: Standalone .NET framework exe Pin
LostTime7621-Jul-13 15:05
LostTime7621-Jul-13 15:05 
GeneralRe: Standalone .NET framework exe Pin
Dave Kreskowiak22-Jul-13 1:50
mveDave Kreskowiak22-Jul-13 1:50 
GeneralRe: Standalone .NET framework exe Pin
LostTime764-Aug-13 9:22
LostTime764-Aug-13 9:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.