The invention relates generally to computer system support of application program execution and, more particularly but not by way of limitation, to a method and apparatus for redirecting command line utility output to a non-application maintained storage location.
Many applications such as word processing and file viewing programs have occasion to access system information. Often, such system information is available only through command line (e.g., console) utilities. That is, utilities that are accessible only through a command line interface. Illustrative command line utilities include “dir” and “net view” commands available in the Microsoft WINDOWS® operating system and the “w” command available in UNIX® and UNIXe-like operating systems (provides a list of users logged onto a specified computer system).
One difficulty with command line utilities is that their output is not generally directly useable by an executing application. The conventional technique by which a user application obtains command line utility output is shown in
A problem with the technique of
Thus, it would be beneficial to provide a mechanism by which an application program may obtain output from a command line utility without the need to create a temporary file.
In one embodiment the invention provides a method to provide command line utility output to an application without the need of temporary files. The method includes receiving an identifier, receiving output from a command line utility, and storing the command line utility output in a system storage at a location identified by the identifier. In one illustrative embodiment, command line utility output is stored in a system registry database, which is stored in active memory (temporary storage) when the system is active and stored in a file (permanent storage) when the system is inactive. In another illustrative embodiment, command line utility output is stored in a shared system memory. The method may be stored in any media that is readable and executable by a computer system.
Referring to
One benefit of a redirection routine in accordance with
Still another benefit of the invention is that the application invoking redirection routine 200 does not have to have disk I/O (input-output) authority as the storage location is maintained by the underlying operating system—the application makes I/O calls to the specified storage location through standard system calls (see discussion below).
By way of example, consider a situation in which an executing application needs information of the type provided by command line utility CMD-UTIL, where CMD-UTIL represents any utility executable from a command line prompt (e.g., the “dir” directory command of a Microsoft WINDOWS® operating system or the “head” command of a UNIX® operating system). In accordance with the invention, the application invokes a system call of the form:
It will be recognized that the calling application will generally ensure that the identifier it passes to routine 200 has either not been used or may be reused. It will further be recognized that command utilities may be stacked. That is, output from a first command utility (CMD-UTIL-1, for example) may be piped to a second, third, or Nth command utility (CMD-UTIL-N, for example) which may then be piped to routine 200. In this case, a system call in accordance with the invention would be:
Because many current personal computer systems (PCs) are operated or controlled by one version or another of the Microsoft WINDOWS® operating system, an illustrative embodiment of redirection routine 200 utilizing the WINDOWS® system registry (hereinafter, the registry) will now be given. It will be recognized that the registry is an operating system generated and maintained database which application programs, application setup programs, and the operating system itself use to store configuration information.
Information stored in the registry is organized into hierarchical keys and associated key entries. Current versions of the registry use six predefined root keys (AKA Hives): HKEY_USERS; HKEY.CLASSES.ROOT; HKEY.CURRENT.USER; HKEY.CURRENT.CONFIG; HKEY_LOCAL.MACHINE; and HKEY.DYN.DATA. Each key in the registry can have one or more sub-key entries. Each key and sub-key can have one or more names (a unique character string identifier) and each name can have an associated value (data stored in a defined manor, may be a character string, binary data, a number, a Boolean value, etc.). Each key and sub-key has one default key entry that has no name.
Access to the registry is provided through system calls defined in the registry application programming interface (API). Illustrative registry API functions include: RegEnumKeyEx, which enumerates the sub-keys of a specified key; RegOpenKeyEx, which opens and returns a handle to a specified key; RegEnumValue, which enumerates the key entries associated with a specified key; RegQueryValueEx, which returns the assigned value of a specified key entry; RegSetValueEx, which assigns a value to a specified key entry, creating the key entry if the key entry was not previously registered; RegDeleteKey, which removes a key from the registry; and RegDeleteValue, which removes a key entry from the registry. Using keys (hereinafter understood to include sub-keys) and registry API system calls, routine 200 can store command line utility output in the registry file. Using the same keys, an application program can retrieve information previously stored by routine 200.
Referring now to
In another embodiment, the ID parameter includes a storage location identifier. One value of the storage location identifier may direct use of the registry (or a similar operating system maintained database) while another value of the storage location identifier may direct use of operating system shared 30 memory (e.g., volatile random access memory). One example of operating system shared memory is the “clipboard” memory maintained by the WINDOWS® operating system.
Referring now to
Various changes in the details of the illustrated operational methods as well as in the components of computer system 400 are possible without departing from the scope of the following claims. For instance, instructions to perform the acts of
Thus, while the invention has been disclosed with respect to a limited number of embodiments, numerous modifications and variations will be appreciated by those skilled in the art. It is intended, therefore, that the following claims cover all such modifications and variations that may fall within the true sprit and scope of the invention.
This application is a continuation of U.S. patent application Ser. No. 09/449,782, which was filed on Nov. 26, 1999.
Number | Name | Date | Kind |
---|---|---|---|
5664153 | Farrell | Sep 1997 | A |
5745669 | Hugard et al. | Apr 1998 | A |
5758154 | Qureshi | May 1998 | A |
5848025 | Marietta et al. | Dec 1998 | A |
5862379 | Rubin et al. | Jan 1999 | A |
5983325 | Lewchuk | Nov 1999 | A |
6052134 | Foster | Apr 2000 | A |
6052756 | Barnaby et al. | Apr 2000 | A |
6061253 | Jeddeloh | May 2000 | A |
6093215 | Buxton et al. | Jul 2000 | A |
6141792 | Acker et al. | Oct 2000 | A |
6151701 | Humphreys et al. | Nov 2000 | A |
6177939 | Blish et al. | Jan 2001 | B1 |
6182279 | Buxton et al. | Jan 2001 | B1 |
6199138 | Jeddeloh | Mar 2001 | B1 |
6212598 | Jeddeloh | Apr 2001 | B1 |
6385766 | Doran et al. | May 2002 | B1 |
6405362 | Shih et al. | Jun 2002 | B1 |
6535930 | Stern et al. | Mar 2003 | B2 |
6681265 | Hlava | Jan 2004 | B1 |
Entry |
---|
Hill, Tim. “The Windows NT Command Shell”, Windows NT Shell Scripting. Copyright 1998. MacMillian Technical Publishing. (retrieved Jul. 15, 2012, available at http://technet.microsoft.com/en-us/library/cc723564.aspx#XSLTsection127121120120). |
Robichaux, Paul. “Admistering the Windows NT Registry” Chapter 8, Managing the Windows NT registry, 1998. Available at <http://technet.microsoft.com/en-us/library/cc749939.aspx>. |
“Internet Component Download”, Microsoft Corporation, Jan. 1996, http://www.graphcomp.com/info/specs/ms/CODEDWLD.HTM. |
“Microsoft Computer Dictionary Fifth Edition”, p. 111 & 544, 2002, Microsoft Press, retrieved Dec. 15, 2004. |
“Programming the Win32 Registry”, http//www.geocities.com/SiliconValley/2072/prgw32rg.htm?20067. |
“Using Command-Line Utilities”, p. E1-#12, retrieved Dec. 15, 2004, www.cisco.com/univercd/cc/td/doc/product/rtmgmt/sw—ntman/td—main/td—5—8/traf5—8/cmdline.pdf. |
“Windows 95 Application Setup Guidelines for Independent Software Vendors” 1995, http://msdn.microsoft.com/library/techart/setup.htm. |
“Windows 95 Secrets, 3rd Edition”, p. 315, 1995, “The DOS Version of the Registry Editor”, retrieved Dec. 15, 2004. |
“Windows registry”, Wikipedia; http://en.wikipedia.org.wiki/Windows—Registry, retrieved from google.com search Jan. 31, 2006. |
Dietel, H.M.; “Operating Systems”, (1990), p. 574, command line and redirection, p. 644, redirected output, output of a command piped to another command. |
Hill, Tim; “The Windows NT Command Shell”, 1998, retrieved from URL http://www.microsoft.com/technet/archive/winntas/deploy/prodspecs/shellscr.mspx?mfr=true on Oct. 15, 2007. |
Kochan, Stephen G., Wood, Patrick H., ''Exploring the UNIX System Second Edition, 1989, p. 11, p. 81-84, p. 103-111. |
Russinovich, Mark, “inside the Windows NT Registry”, Apr. 1997, WindowsNT Magazine, retrieved from http://www.winnetmag.com/Articles/Index.cfm?ArticleID=122, retrieved on Aug. 14, 2002. |
Weber Systems, Inc. Staff, “UNIX User's Handbook”, 1985, p. 170-177. |
Number | Date | Country | |
---|---|---|---|
20110225598 A1 | Sep 2011 | US |
Number | Date | Country | |
---|---|---|---|
Parent | 09449782 | Nov 1999 | US |
Child | 13111775 | US |