Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Extract System's register's value by usiong 'C' language

Extract System's register's value by usiong 'C' language

Scheduled Pinned Locked Moved C / C++ / MFC
14 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    kushMuchaal
    wrote on last edited by
    #1

    Dear sir, I want to retrieve the value of Registers of operating systems by using C language.

    A L 2 Replies Last reply
    0
    • K kushMuchaal

      Dear sir, I want to retrieve the value of Registers of operating systems by using C language.

      A Offline
      A Offline
      Aescleal
      wrote on last edited by
      #2

      Hi, The first bad news is that operating systems don't have registers, the processor does. Secondly there's no portable way of reading them in C - it's processor and compiler dependent, if you can do it at all. Just out of interest, is there any particular reason you want to do this as most of the things you read will be completely meaningless in the wider operating system context? Cheers, Ash

      K 3 Replies Last reply
      0
      • K kushMuchaal

        Dear sir, I want to retrieve the value of Registers of operating systems by using C language.

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        I do not think you can access the registers directly in C (in C++ use the __asm keyword). However, even if you could address them their content will be meaningless beyond containing a few variables local to your function. Perhaps you could clarify what you are trying to achieve.

        It's time for a new signature.

        K 1 Reply Last reply
        0
        • A Aescleal

          Hi, The first bad news is that operating systems don't have registers, the processor does. Secondly there's no portable way of reading them in C - it's processor and compiler dependent, if you can do it at all. Just out of interest, is there any particular reason you want to do this as most of the things you read will be completely meaningless in the wider operating system context? Cheers, Ash

          K Offline
          K Offline
          kushMuchaal
          wrote on last edited by
          #4

          Hi! Thanks for giving interest in my problem. Acctually I have an pripherial device(MS-DOS) based;I want to retrieve their SerialNumber or any internal information. Ex. We can retrieve the Motherboard number by using getipaddress();

          1 Reply Last reply
          0
          • A Aescleal

            Hi, The first bad news is that operating systems don't have registers, the processor does. Secondly there's no portable way of reading them in C - it's processor and compiler dependent, if you can do it at all. Just out of interest, is there any particular reason you want to do this as most of the things you read will be completely meaningless in the wider operating system context? Cheers, Ash

            K Offline
            K Offline
            kushMuchaal
            wrote on last edited by
            #5

            I m sorry;Getipaddress is used for IP Address;also we can retrieve the Motherboard number.

            1 Reply Last reply
            0
            • L Lost User

              I do not think you can access the registers directly in C (in C++ use the __asm keyword). However, even if you could address them their content will be meaningless beyond containing a few variables local to your function. Perhaps you could clarify what you are trying to achieve.

              It's time for a new signature.

              K Offline
              K Offline
              kushMuchaal
              wrote on last edited by
              #6

              I like clear my problem with explanation. **EX:**If i used the Usb Drive(pen Drive)to my computer system; I want to extract the Serial Number or any Internal information from the memory of the USB. If u have any idea plz tell me.

              1 Reply Last reply
              0
              • A Aescleal

                Hi, The first bad news is that operating systems don't have registers, the processor does. Secondly there's no portable way of reading them in C - it's processor and compiler dependent, if you can do it at all. Just out of interest, is there any particular reason you want to do this as most of the things you read will be completely meaningless in the wider operating system context? Cheers, Ash

                K Offline
                K Offline
                kushMuchaal
                wrote on last edited by
                #7

                I like to clear my problem with explanation. EX:If i used the Usb Drive(pen Drive)to my computer system; I want to extract the Serial Number or any Internal information from the memory of the USB. If u have any idea plz tell me.

                A 1 Reply Last reply
                0
                • K kushMuchaal

                  I like to clear my problem with explanation. EX:If i used the Usb Drive(pen Drive)to my computer system; I want to extract the Serial Number or any Internal information from the memory of the USB. If u have any idea plz tell me.

                  A Offline
                  A Offline
                  Aescleal
                  wrote on last edited by
                  #8

                  Ah, okay. Despite working for a harddisk manufacturer I've never dug around in USB. If you're using Windows then http://www.emmet-gray.com/Articles/USB_SerialNumbers.htm[^] seems to have all the recipes you'd need to grab the serial number from a USB 2.0 device. One problem is that the code is written in VB, but it gives the sequence of Win32 calls you'd need to make to get the information (and it's a bit convoluted - hopefully someone more in the know can point you at a simpler method). If you're using another OS then there's probably a similar recipe out there somewhere. Another alternative would be to write a device driver and tickle the device directly through it's I/O ports and see how it giggles. However you'll need to know more than most mortals should need to know about USB - and having seen a colleague of mine go bald reading the OHCI, UHCI and EHCI specs I wouldn't wish that on anyone. Cheers, Ash PS: Perhaps posting another question with "Reading configuration data (e.g. serial number) from a USB device" might attract someone who knows what they're talking about.

                  K 1 Reply Last reply
                  0
                  • A Aescleal

                    Ah, okay. Despite working for a harddisk manufacturer I've never dug around in USB. If you're using Windows then http://www.emmet-gray.com/Articles/USB_SerialNumbers.htm[^] seems to have all the recipes you'd need to grab the serial number from a USB 2.0 device. One problem is that the code is written in VB, but it gives the sequence of Win32 calls you'd need to make to get the information (and it's a bit convoluted - hopefully someone more in the know can point you at a simpler method). If you're using another OS then there's probably a similar recipe out there somewhere. Another alternative would be to write a device driver and tickle the device directly through it's I/O ports and see how it giggles. However you'll need to know more than most mortals should need to know about USB - and having seen a colleague of mine go bald reading the OHCI, UHCI and EHCI specs I wouldn't wish that on anyone. Cheers, Ash PS: Perhaps posting another question with "Reading configuration data (e.g. serial number) from a USB device" might attract someone who knows what they're talking about.

                    K Offline
                    K Offline
                    kushMuchaal
                    wrote on last edited by
                    #9

                    Thanks for this response; But actually have an other Electronics device Ms-DOS based, Please clerify how to retrieve the information any system which can communicate with Computer System.

                    A 1 Reply Last reply
                    0
                    • K kushMuchaal

                      Thanks for this response; But actually have an other Electronics device Ms-DOS based, Please clerify how to retrieve the information any system which can communicate with Computer System.

                      A Offline
                      A Offline
                      Aescleal
                      wrote on last edited by
                      #10

                      I'm not sure what you mean by a device being MS-DOS based. If you can expand that a bit I might be able to point you somewhere to help. Cheers, Ash

                      K 1 Reply Last reply
                      0
                      • A Aescleal

                        I'm not sure what you mean by a device being MS-DOS based. If you can expand that a bit I might be able to point you somewhere to help. Cheers, Ash

                        K Offline
                        K Offline
                        kushMuchaal
                        wrote on last edited by
                        #11

                        Hi, ok ,I have an CMRI is an Energy Meter Reading Device; I want to know the serial no. of CMRI;which is unique & provided by the manufacturer. CMRI is Ms-Dos based device. PLz help me

                        D L A 3 Replies Last reply
                        0
                        • K kushMuchaal

                          Hi, ok ,I have an CMRI is an Energy Meter Reading Device; I want to know the serial no. of CMRI;which is unique & provided by the manufacturer. CMRI is Ms-Dos based device. PLz help me

                          D Offline
                          D Offline
                          David Crow
                          wrote on last edited by
                          #12

                          Seems to me that the manufacturer of the device would have provided such with their API.

                          "One man's wage rise is another man's price increase." - Harold Wilson

                          "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

                          "Man who follows car will be exhausted." - Confucius

                          1 Reply Last reply
                          0
                          • K kushMuchaal

                            Hi, ok ,I have an CMRI is an Energy Meter Reading Device; I want to know the serial no. of CMRI;which is unique & provided by the manufacturer. CMRI is Ms-Dos based device. PLz help me

                            L Offline
                            L Offline
                            Lost User
                            wrote on last edited by
                            #13

                            kushMuchaal wrote:

                            CMRI is Ms-Dos based device.

                            Please explain what is meant by MS-DOS based device - this makes no sense.

                            It's time for a new signature.

                            1 Reply Last reply
                            0
                            • K kushMuchaal

                              Hi, ok ,I have an CMRI is an Energy Meter Reading Device; I want to know the serial no. of CMRI;which is unique & provided by the manufacturer. CMRI is Ms-Dos based device. PLz help me

                              A Offline
                              A Offline
                              Aescleal
                              wrote on last edited by
                              #14

                              Just done a bit of digging... Okay, looks like CRMI devices are used to read 'leccy and gas meters. They seem to have RS232 or USB interfaces on them and usually come with a suite of tools through which you can connect the CRMI to a host computer. These CRMI things seem to run something that looks like PC-DOS or MS-DOS but that's a complete red herring, it has no bearing on getting data off the device. Now if the device has a USB port and follows the USB 2.0 specification then the link I dropped in an earlier post will show you the sequence of function calls you need to make to get the device's serial number. From what I've read the USB capable ones are just USB mass storage devices and look like any other disk drive when they plug in. If you want the data on the device you can then just use ordinary C standard library function calls to open the files on it. Cheers, Ash

                              1 Reply Last reply
                              0
                              Reply
                              • Reply as topic
                              Log in to reply
                              • Oldest to Newest
                              • Newest to Oldest
                              • Most Votes


                              • Login

                              • Don't have an account? Register

                              • Login or register to search.
                              • First post
                                Last post
                              0
                              • Categories
                              • Recent
                              • Tags
                              • Popular
                              • World
                              • Users
                              • Groups