Any c# programmers about who have used deviceIoControl before?

kernow

The Goob Hunter
20 Year Member
Joined
Sep 1, 2001
Posts
34,960
I've played around with UAC, disabled, enabled, does the same thing.

edit:
You're right! - just turned UAC off again, and ran a dos prompt as administrator, then run your console application, works fine. wtf.

You'd think it'd at least ask via UAC if you wanted to run it, the other imagewriter I have does. Why doesn't mine? :crying:

fucking windows.


god, if I run my app as admin it works too. fuuu

if I right click mine and run it as administrator it asks via UAC, and then works too. Would be nice if it could trigger it itself.

oh ffs, it's also reading fine now also.
 
Last edited:

lantus360

Fu'un-Ken Master
Joined
Feb 25, 2012
Posts
1,527
ya thats what i thought. UAC wont matter - When you run code through the VS debugger it need to be with admin privs if you are going to do low(ish) level deviceio stuff.

glad its working for you!
 

kernow

The Goob Hunter
20 Year Member
Joined
Sep 1, 2001
Posts
34,960
This is a right pain in the arse now, I need to come out of visual studio and right click on the built application to run as administrator every time, just to test it, because if I just compile and run it it doesn't have the correct rights and produces all the wrong answers!

ob.bytesPerSector is 1 too. ... not 512?

I'm wondering how you're running yours on windows and how it's different to my setup here really. hmm.

The other image tool requests via UAC it runs as admin on startup . it's written in QT4 too ffs which makes me laugh, I bet it's built on cygwin also and is just doing a raw read and write on '/dev/sda' or some shit too. Anyway I don't care how that one works, apart from the UAC bit, hmm.
 
Last edited:

lantus360

Fu'un-Ken Master
Joined
Feb 25, 2012
Posts
1,527
just right click the VS icon, go to 'properties' and on the compatibility tab check 'Run as administrator' then you wont need to
 

kernow

The Goob Hunter
20 Year Member
Joined
Sep 1, 2001
Posts
34,960
http://www.designlimbo.com/?p=82

Sorted it so that the built app is always UAC dependent, now it doesn't even run as a normal user and requests this every time just like the other image tool.

Now all I need to do is fix the broken write function (reading is byte for byte identical to the other image tool), work out why bytes per sector is being returned as 1 and not 512, actually get rid of the hardcoded device bytes size, and work out why it's so bloody slow (this is a lot of things actually), and I'll have all the functionality in there. Then I can just worry about GUI threads and the progress bar pretty much, and stupid GUI shit like making sure it's all reset properly after cancels and completed operations.
 
Top