RunUO Community

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

Windows Actions

mordero

Knight
You might be able to use the System.Management namespace for some of that (just found that on a quick google search) but you can also do all of that using PInvoke and the Window APIs. Just search google for code on how to do some of that stuff...

A useful website if you start using the APIs
pinvoke.net: the interop wiki!
 

Jeff

Lord
Storm33229;651179 said:
windows actions as in... uhh. like Reboot? Uhm, eject disk? Power-Off. Create account. etc.

I highly doubt thats as simply as your hoping it is. And pinvoke.net is a godsend :)
 
well it's probably not as simple as creating a new instance of an account and defining specific variables belonging to it... but it has got to be possible to do it somehow. and I am figuring C# has a class to do it, just do not know how.
 

mordero

Knight
Like I said, check out the System.Managment namespace and see if it has anything to offer you. And you can do these things using the Windows APIs, it just takes some work...
 
mordero;651231 said:
Like I said, check out the System.Managment namespace and see if it has anything to offer you. And you can do these things using the Windows APIs, it just takes some work...

aight cool. I'll check it out when i get home. (@school)
 

Jeff

Lord
mordero;651231 said:
Like I said, check out the System.Managment namespace and see if it has anything to offer you. And you can do these things using the Windows APIs, it just takes some work...

System.Management is more for info, Ive not found much in the way of doing things with it, its more for info about the PC. Its also a big pain in the ass to use :)
 

mordero

Knight
Lol ok, so dont use System.Management haha

(I didnt even know about it until I searched for restarting a comp in c# on google)
 

Jeff

Lord
Provides access to a rich set of management information and management events about the system, devices, and applications instrumented to the Windows Management Instrumentation (WMI) infrastructure. Applications and services can query for interesting management information (such as how much free space is left on the disk, what is the current CPU utilization, which database a certain application is connected to, and much more), using classes derived from ManagementObjectSearcher and ManagementQuery, or subscribe to a variety of management events using the ManagementEventWatcher class. The accessible data can be from both managed and unmanaged components in the distributed environment.

System.Management Namespace
 
Jeff;651240 said:
Provides access to a rich set of management information and management events about the system, devices, and applications instrumented to the Windows Management Instrumentation (WMI) infrastructure. Applications and services can query for interesting management information (such as how much free space is left on the disk, what is the current CPU utilization, which database a certain application is connected to, and much more), using classes derived from ManagementObjectSearcher and ManagementQuery, or subscribe to a variety of management events using the ManagementEventWatcher class. The accessible data can be from both managed and unmanaged components in the distributed environment.

System.Management Namespace

So you're saying I could write a simple console program using that namespace that will allow me to output all the property values of my computer? # of accounts, account names + passwords etc etc etc.
 

mordero

Knight
maybe the account names (I havent looked at the link yet cause im trying to study for an exam), but not the passwords, I belive they are encrypted (or hashed) even if this namespace provided access to them, which i doubt.
 
mordero;651258 said:
maybe the account names (I havent looked at the link yet cause im trying to study for an exam), but not the passwords, I belive they are encrypted (or hashed) even if this namespace provided access to them, which i doubt.
Ah, well, I basically want to write a password recovery program for my computer just incase anything ever happens.
 

mordero

Knight
Hmmm, well google is your friend.

Also, Im now pretty sure the passwords are encrypted, not hashed because there are programs out there that will crack them for you (although if they use brute force, then they could be hashed).
 

Jeff

Lord
Storm33229;651256 said:
So you're saying I could write a simple console program using that namespace that will allow me to output all the property values of my computer? # of accounts, account names + passwords etc etc etc.

You can essential see and get any info from this WMI API
WMI Reference
 

Jeff

Lord
Storm33229;651684 said:
Seems like you can't use C# with Windows API's. =/ But that was just my observation. Enlighten me plz.

Bull :) look for System.Management stuff, you use it like a database. Ill look for old code.
 

Jeff

Lord
Example of how I used that namespace, before FileSystem.GetDrives() worked :). Not to mention the amount of info u can get out of these objects.

Code:
 foreach( ManagementObject wmi_HD in searcher.Get() )
            {
                Drive d = new Drive( wmi_HD );
                 m_Drivetable.Add( d.Model, d );
            }

Then in Drive i did this

Code:
public Drive( ManagementObject hdd)
        {
            m_BytesPerSector = ( uint )hdd["BytesPerSector"] ;
            m_DeviceID = ( string )hdd["DeviceID"] ;
            m_Index = ( uint )hdd["Index"] ;
            m_InterfaceType = ( string )hdd["InterfaceType"] ;
            m_Manufacturer = ( string )hdd["Manufacturer"] ;
            m_MediaType = ( string )hdd["MediaType"] ;
            m_Model = ( string )hdd["Model"] ;
            m_Name = ( string )hdd["Name"] ;   
            m_Partitions = ( uint )hdd["Partitions"] ;
            m_SectorsPerTrack = ( uint )hdd["SectorsPerTrack"] ;
            m_Signature = ( uint )hdd["Signature"] ;
            m_Size = ( ulong )hdd["Size"] ;
            m_Status = ( string )hdd["Status"];
            m_TotalCylinders = ( ulong )hdd["TotalCylinders"];
            m_TotalHeads = ( uint )hdd["TotalHeads"];
            m_MaxSectors = ( ulong )hdd["TotalSectors"];
            m_TotalTracks = ( ulong )hdd["TotalTracks"];
        }

Hope this helps, but like i said, this stuff is mostely for Info.
 
Top