# US 2005/0097578 A1 · System and method for executing an arbitrary function from an external process

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2005/0097578 A1
- Document ID: US20050097578A1
- Status: Published application
- Kind: A1
- Application number: 10/697,604
- Filed: 2003-10-30
- Published: 2005-05-05
- Earliest claimed: 2003-10-30
- Assignees: Microsoft Corporation
- Inventors: Rajasekaran Rangarajan
- Web page: https://patentgrep.com/patent/US20050097578A1

## CPC

- G06F 9/547: {Remote procedure calls [RPC]; Web services}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

A first process executes a function in a second process. The second process may be a remote or local process. The first process may control the second process by executing a specified function in the second process. The first process may allocate space in the second process and create a stub function in the allocated space. The first process then may create a thread which runs the stub function. When the stub function is called from the first process, the stub function may call the arbitrary function, passing it the required parameters, thus enabling the first process to execute the desired function in the second process. The desired process may require any number and type of additional parameters and return any number and type of results.

## Claims

### Claim 1

A system for executing a function in a second process from a first process, comprising a function controller, the function controller:
allocating space in a second process from a first process;
writing a stub function into the allocated space in the second process;
passing a single parameter to the stub function written into the allocated space in the second process, the single parameter identifying the function within the second process to execute, and at least one parameter required by the function to execute.

### Claim 2 (depends on 1)

The system of claim 1, wherein the function controller returns the result of execution of the function to execute to the first process.

### Claim 3 (depends on 1)

The system of claim 1, wherein the first process controls the second process.

### Claim 4 (depends on 1)

The system of claim 1, wherein the function within the second process to execute requires a plurality of parameters.

### Claim 5 (depends on 1)

The system of claim 1, wherein the single parameter passed to the stub function comprises a pointer to a location in memory in the second process.

### Claim 6 (depends on 5)

The system of claim 5, wherein the location in memory comprises an address, the address comprising the location of the function to execute in the second process.

### Claim 7 (depends on 6)

The system of claim 6, wherein the address comprises the location of at least one parameter required by the function to execute.

### Claim 8 (depends on 1)

The system of claim 1, wherein the result of executing the function to execute is returned to the first process.

### Claim 9 (depends on 8)

The system of claim 8, wherein the result of executing the function to execute is returned to the first process by providing a pointer to the first process, the pointer pointing to stored data, the stored data comprising the result of executing the function to execute.

### Claim 10 (depends on 9)

The system of claim 9, wherein the pointer points to memory in the second process.

### Claim 11

A method for executing a function within a second process from a first process, the method comprising:
allocating space within the second process;
writing a stub function into the allocated space within the second process;
identifying to the stub function the function in the second process to execute by passing information to the stub function.

### Claim 12 (depends on 11)

The method of claim 11, wherein the information passed to the stub function comprises an address in memory within the second process.

### Claim 13 (depends on 11)

The method of claim 11, wherein the function in the second process to be executed by the stub function in the second process is identified by providing a pointer to a location in memory in the second process at which the function to be executed is stored.

### Claim 14 (depends on 13)

The method of claim 13, wherein at least one parameter required by the function to be executed is identified by providing an offset from the location in memory at which the function to be executed is stored.

### Claim 15 (depends on 13)

The method of claim 13, further comprising receiving from the stub function in the second process a result of executing the function identified by the pointer to the location in memory.

### Claim 16 (depends on 13)

The method of claim 13, wherein the first process controls the second process by executing the stub function.

### Claim 17 (depends on 13)

The method of claim 13, wherein the stub function is executed by creating a thread in the second process to execute the stub function.

### Claim 18

A computer-readable medium including computer-executable instructions to execute a function within a second process from a first process by:
allocating space within the second process;
writing a stub function into the allocated space within the second process;
identifying to the stub function a function to execute in the second process by passing the stub function a single parameter, the parameter comprising a pointer to an address in memory in the second process.

### Claim 19 (depends on 18)

The computer-readable medium of claim 18, further comprising receiving from the stub function a result of executing the function in the second process.

### Claim 20 (depends on 18)

The computer-readable medium of claim 18, wherein the function to execute requires a plurality of input parameters.

### Claim 21 (depends on 20)

The computer-readable medium of claim 20, wherein the sub function initializes the plurality of input parameters to values located at specified offsets from the address in memory pointed to by the pointer.

### Claim 22 (depends on 19)

The computer-readable medium of claim 19, wherein the result of executing the function in the second process is stored at a location received from the stub function as a output parameter.
