Example #1
0
        private void Configuration_Load(object sender, EventArgs e)
        {
            this.MaximizeBox   = false;
            this.MinimizeBox   = false;
            this.StartPosition = FormStartPosition.Manual;
            int x = GetScreen().Width - (this.Width + 20);
            int y = GetScreen().Height - (this.Height + 80);

            this.Location   = this.PointToScreen(new Point(x, y));
            this.KeyPreview = true;

            try
            {
                RegistryHandle reg = new RegistryHandle();
                RegistryHandle.Configuration config = reg.ReadConfig();

                txtEventName.Text    = config.EventName;
                txtInstallation.Text = config.Installation;
                txtQueueType.Text    = config.QueueOptions;
                txtQueueNumber.Text  = config.QueueNumber.ToString();
                txtExecution.Text    = config.Execution;
                txtLocation.Text     = config.Location;
                txtOtherEvent.Text   = config.OtherEvent;
                txtUseReader.Text    = config.UseReader.ToString();
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
            }
        }
Example #2
0
        private static object ReadValue(string key, string value)
        {
            object obj2;

            try
            {
                using (RegistryHandle handle = RegistryHandle.GetNativeHKLMSubkey(key, false))
                {
                    if (handle == null)
                    {
                        return(null);
                    }
                    obj2 = handle.GetValue(value);
                }
            }
            catch (SecurityException exception)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new TransactionManagerConfigurationException(System.ServiceModel.SR.GetString("WsatRegistryValueReadError", new object[] { value }), exception));
            }
            catch (IOException exception2)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new TransactionManagerConfigurationException(System.ServiceModel.SR.GetString("WsatRegistryValueReadError", new object[] { value }), exception2));
            }
            return(obj2);
        }
Example #3
0
        // SDK location: /registry/pspreg.h:68
        // SDK declaration: int sceRegOpenRegistry(struct RegParam *reg, int mode, REGHANDLE *h);
        public int sceRegOpenRegistry(int reg, int mode, int h)
        {
            //unsigned int  regtype
            //char  name [256]          //Seemingly never used, set to "/system".
            //unsigned int  namelen         //Length of the name.
            //unsigned int  unk2            //Unknown, set to 1.
            //unsigned int  unk3            //Unknown, set to 1.
            // mode = 1

            string name = _kernel.ReadString(( uint )reg + 4);

            RegistryHandle handle = new RegistryHandle();

            handle.Type = RegistryHandleType.Registry;
            handle.ID   = _lastId++;
            handle.Key  = _system;
            _handles.Add(handle);

            if (h != 0)
            {
                int *ph = ( int * )_memorySystem.TranslateMainMemory(h);
                *    ph = handle.ID;
            }
            return(0);
        }
Example #4
0
        static object ReadValue(string key, string value)
        {
            try
            {
                using (RegistryHandle regKey = RegistryHandle.GetNativeHKLMSubkey(key, false))
                {
                    if (regKey == null)
                    {
                        return(null);
                    }

                    return(regKey.GetValue(value));
                }
            }
            catch (SecurityException e)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(
                          new TransactionManagerConfigurationException(SR.GetString(SR.WsatRegistryValueReadError, value), e));
            }
            catch (IOException e)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(
                          new TransactionManagerConfigurationException(SR.GetString(SR.WsatRegistryValueReadError, value), e));
            }
        }
Example #5
0
        // SDK location: /registry/pspreg.h:117
        // SDK declaration: int sceRegCloseCategory(REGHANDLE hd);
        public int sceRegCloseCategory(int hd)
        {
            RegistryHandle handle = this.GetHandle(hd);

            if (handle == null)
            {
                return(-1);
            }
            else
            {
                _handles.Remove(handle);
                return(0);
            }
        }
Example #6
0
        private void Configuration_FormClosing(object sender, FormClosingEventArgs e)
        {
            try
            {
                RegistryHandle reg = new RegistryHandle();
                RegistryHandle.Configuration config = null;
                int  QueueNum;
                bool UseReader;

                config = new RegistryHandle.Configuration(txtEventName.Text, txtInstallation.Text, txtQueueType.Text,
                                                          txtExecution.Text, int.TryParse(txtQueueNumber.Text, out QueueNum) ? QueueNum : 1, txtLocation.Text, txtOtherEvent.Text, Boolean.TryParse(txtUseReader.Text, out UseReader) ? UseReader : false);

                reg.WriteConfig(config);
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
            }
        }
Example #7
0
        // SDK location: /registry/pspreg.h:98
        // SDK declaration: int sceRegOpenCategory(REGHANDLE h, const char *name, int mode, REGHANDLE *hd);
        public int sceRegOpenCategory(int h, int name, int mode, int hd)
        {
            RegistryHandle registryHandle = this.GetHandle(h);

            if (registryHandle == null)
            {
                return(-1);
            }

            RegistryKey key = registryHandle.Key;

            // This is probably wrong
            string categoryPath = _kernel.ReadString(( uint )name);

            string[] path = categoryPath.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries);
            foreach (string pathElement in path)
            {
                foreach (RegistryKey child in key.Children)
                {
                    if (child.Name == pathElement)
                    {
                        key = child;
                        break;
                    }
                }
            }

            RegistryHandle handle = new RegistryHandle();

            handle.Type = RegistryHandleType.Category;
            handle.ID   = _lastId++;
            handle.Key  = key;
            _handles.Add(handle);

            Log.WriteLine(Verbosity.Verbose, Feature.Bios, "sceRegOpenCategory( {0}::{1} )", registryHandle.Key.Name, categoryPath);

            if (hd != 0)
            {
                int *phd = ( int * )_memorySystem.TranslateMainMemory(hd);
                *    phd = handle.ID;
            }
            return(0);
        }
Example #8
0
        //Process button
        private void ViewOptions(string ID)
        {
            string         message = string.Empty;
            RegistryHandle reg     = new RegistryHandle();

            RegistryHandle.Configuration config = reg.ReadConfig();

            if (config.EventName == string.Empty)
            {
                MessageBox.Show("No configuration setup");
                this.Close();
                return;
            }

            /*
             * if (!CheckRouting(config.Installation, config.EventName))
             * {
             *  MessageBox.Show("Routing is incorrect.");
             *  this.Close();
             *  return;
             * }
             */

            message = string.Format("<Message><CUMS_AuthorityRFID><SEL_ID>{0}</SEL_ID><STATION_NAME>{1}</STATION_NAME>" +
                                    "<LOCAL_USER>{2}</LOCAL_USER><TIME_STAMP>{3}</TIME_STAMP><LOCATION>{4}</LOCATION>" +
                                    "<OTHER_EVENT>{5}</OTHER_EVENT></CUMS_AuthorityRFID></Message>", ID, Environment.MachineName,
                                    Environment.UserName, DateTime.Now, config.Location, config.OtherEvent);

            if (clsClarifi.CheckAgentStatus() != clsClarifi.AgentStatus.Started && message != String.Empty)
            {
                MessageBox.Show("Clarif-i Agent Stopped");
                this.Close();
                return;
            }
            else
            {
                clsClarifi.TriggerAgent(config.EventName, config.Installation, message, config.Execution,
                                        config.QueueOptions, config.QueueNumber);
                this.Close();
                return;
            }
        }
Example #9
0
        // SDK location: /registry/pspreg.h:163
        // SDK declaration: int sceRegGetKeyValue(REGHANDLE hd, REGHANDLE hk, void *buf, SceSize size);
        public int sceRegGetKeyValue(int hd, int hk, int buf, int size)
        {
            RegistryHandle categoryHandle = this.GetHandle(hd);

            if (categoryHandle == null)
            {
                return(-1);
            }

            RegistryHandle keyHandle = categoryHandle.GetHandle(hk);

            if (keyHandle == null)
            {
                return(-1);
            }

            byte *pbuf = _memorySystem.TranslateMainMemory(buf);

            switch (keyHandle.Key.Type)
            {
            case RegistryKeyType.Integer:
                *(( int * )pbuf) = keyHandle.Key.ValueI;
                break;

            case RegistryKeyType.String:
                _kernel.WriteString(( uint )buf, keyHandle.Key.ValueS);
                break;

            case RegistryKeyType.Binary:
            {
                byte[] value = keyHandle.Key.ValueB;

                fixed(byte *pvalue = &value[0])
                MemorySystem.CopyMemory(pvalue, pbuf, ( uint )value.Length);
            }
            break;
            }

            return(0);
        }
Example #10
0
        // SDK location: /registry/pspreg.h:139
        // SDK declaration: int sceRegGetKeyInfo(REGHANDLE hd, const char *name, REGHANDLE *hk, unsigned int *type, SceSize *size);
        public int sceRegGetKeyInfo(int hd, int name, int hk, int type, int size)
        {
            RegistryHandle categoryHandle = this.GetHandle(hd);

            if (categoryHandle == null)
            {
                return(-1);
            }

            string keyName = _kernel.ReadString(( uint )name);

            Log.WriteLine(Verbosity.Verbose, Feature.Bios, "sceRegGetKeyInfo( {0}/{1} )", categoryHandle.Key.Name, keyName);

            RegistryKey key = null;

            foreach (RegistryKey child in categoryHandle.Key.Children)
            {
                if (child.Name == keyName)
                {
                    key = child;
                    break;
                }
            }

            Debug.Assert(key != null);
            if (key == null)
            {
                return(-1);
            }

            RegistryHandle handle = new RegistryHandle();

            handle.Type = RegistryHandleType.Key;
            handle.ID   = _lastId++;
            handle.Key  = key;
            categoryHandle.Handles.Add(handle);

            int typev = ( int )key.Type;
            int sizev = 0;

            switch (key.Type)
            {
            case RegistryKeyType.Integer:
                sizev = 4;
                break;

            case RegistryKeyType.String:
                sizev = key.ValueS.Length + 1;
                break;

            case RegistryKeyType.Binary:
                sizev = key.ValueB.Length;
                break;
            }

            if (hk != 0)
            {
                int *phk = ( int * )_memorySystem.TranslateMainMemory(hk);
                *    phk = handle.ID;
            }
            if (type != 0)
            {
                int *ptype = ( int * )_memorySystem.TranslateMainMemory(type);
                *    ptype = typev;
            }
            if (size != 0)
            {
                int *psize = ( int * )_memorySystem.TranslateMainMemory(size);
                *    psize = sizev;
            }

            return(0);
        }
Example #11
0
        public int sceRegOpenRegistry( int reg, int mode, int h )
        {
            //unsigned int  regtype
            //char  name [256] 			//Seemingly never used, set to "/system".
            //unsigned int  namelen 		//Length of the name.
            //unsigned int  unk2 			//Unknown, set to 1.
            //unsigned int  unk3 			//Unknown, set to 1.
            // mode = 1

            string name = _kernel.ReadString( ( uint )reg + 4 );

            RegistryHandle handle = new RegistryHandle();
            handle.Type = RegistryHandleType.Registry;
            handle.ID = _lastId++;
            handle.Key = _system;
            _handles.Add( handle );

            if( h != 0 )
            {
                int* ph = ( int* )_memorySystem.TranslateMainMemory( h );
                *ph = handle.ID;
            }
            return 0;
        }
Example #12
0
        public int sceRegOpenCategory( int h, int name, int mode, int hd )
        {
            RegistryHandle registryHandle = this.GetHandle( h );
            if( registryHandle == null )
                return -1;

            RegistryKey key = registryHandle.Key;

            // This is probably wrong
            string categoryPath = _kernel.ReadString( ( uint )name );
            string[] path = categoryPath.Split( new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries );
            foreach( string pathElement in path )
            {
                foreach( RegistryKey child in key.Children )
                {
                    if( child.Name == pathElement )
                    {
                        key = child;
                        break;
                    }
                }
            }

            RegistryHandle handle = new RegistryHandle();
            handle.Type = RegistryHandleType.Category;
            handle.ID = _lastId++;
            handle.Key = key;
            _handles.Add( handle );

            Log.WriteLine( Verbosity.Verbose, Feature.Bios, "sceRegOpenCategory( {0}::{1} )", registryHandle.Key.Name, categoryPath );

            if( hd != 0 )
            {
                int* phd = ( int* )_memorySystem.TranslateMainMemory( hd );
                *phd = handle.ID;
            }
            return 0;
        }
Example #13
0
        public int sceRegGetKeyInfo( int hd, int name, int hk, int type, int size )
        {
            RegistryHandle categoryHandle = this.GetHandle( hd );
            if( categoryHandle == null )
                return -1;

            string keyName = _kernel.ReadString( ( uint )name );

            Log.WriteLine( Verbosity.Verbose, Feature.Bios, "sceRegGetKeyInfo( {0}/{1} )", categoryHandle.Key.Name, keyName );

            RegistryKey key = null;
            foreach( RegistryKey child in categoryHandle.Key.Children )
            {
                if( child.Name == keyName )
                {
                    key = child;
                    break;
                }
            }

            Debug.Assert( key != null );
            if( key == null )
                return -1;

            RegistryHandle handle = new RegistryHandle();
            handle.Type = RegistryHandleType.Key;
            handle.ID = _lastId++;
            handle.Key = key;
            categoryHandle.Handles.Add( handle );

            int typev = ( int )key.Type;
            int sizev = 0;
            switch( key.Type )
            {
                case RegistryKeyType.Integer:
                    sizev = 4;
                    break;
                case RegistryKeyType.String:
                    sizev = key.ValueS.Length + 1;
                    break;
                case RegistryKeyType.Binary:
                    sizev = key.ValueB.Length;
                    break;
            }

            if( hk != 0 )
            {
                int* phk = ( int* )_memorySystem.TranslateMainMemory( hk );
                *phk = handle.ID;
            }
            if( type != 0 )
            {
                int* ptype = ( int* )_memorySystem.TranslateMainMemory( type );
                *ptype = typev;
            }
            if( size != 0 )
            {
                int* psize = ( int* )_memorySystem.TranslateMainMemory( size );
                *psize = sizev;
            }

            return 0;
        }