PROGRAMMING INTERFACE FOR LICENSING

Information

  • Patent Application
  • 20200034516
  • Publication Number
    20200034516
  • Date Filed
    October 02, 2019
    4 years ago
  • Date Published
    January 30, 2020
    4 years ago
Abstract
A software licensing Application Programming Interface (API) that allows software products to use the license management functionality of a common service. A license specifies rights in a software product. The software product calls a consume method on the API in order to consume a right. If the right exists, the service binds the right to the license in which the right is found. The software product enforces the terms of the license by granting, or denying, access to some or all features depending on whether a valid instance of the right is found. Arbitrary data can be associated with a right. The API includes a method to retrieve data from a right that has been previously bound by the consume method.
Description
FIELD OF THE INVENTION

The present invention relates generally to the field of computer software, and, more particularly, to a programming interface that supports the enforcement of electronic licenses.


BACKGROUND OF THE INVENTION

Commercially-produced software has traditionally been made available under a license that defines the permissible terms of the software's use. When the practice of software licensing first began, the license generally took the form of a legal document that defined the user's rights with respect to the software. Such a document relied upon the legal system for enforcement. It has since become desirable for licenses to be enforced electronically—i.e., it is desirable that a computer program contain code that actively discourages or prevents use of the software in a manner that is contrary to the license.


Most software that provides for electronic license enforcement provides its own infrastructure to manage the licensing of the software and the use of the licenses. Thus, a typical commercial software product may include not only the code to perform the product's core function, but may also carry with it the code to obtain, evaluate, protect, and manage licenses for the software. For each software vendor to develop and incorporate this infrastructure into its software is often a wasteful duplication of effort. It is therefore desirable to provide a system that performs the basic functions related to software licensing, where the system can be used by a broad variety of software applications in a uniform and defined way.


In view of the foregoing, there is a need for a mechanism that overcomes the drawbacks of the prior art.


SUMMARY OF THE INVENTION

The present invention provides a software licensing Application Programming Interface (API) that provides certain licensing functions for use by software products. A license service performs functions relating to the use of licenses, and exposes these functions to software products through the API. The service performs functions such as obtaining licenses, storing and managing licenses, protecting licenses from tampering, evaluating a license's validity, and evaluating whether a license is correctly bound to the machine and/or software product on which it is used. The software is able to make use of this functionality by calling the methods of the API.


In a typical use of the API, a software product calls an “open” API method in order to obtain a unique handle that is used by the license service to identify the application. The software product then calls a “consume right” API method. “Consume,” in this context, means the exercise of a specified right. The call to the “consume right” method is parameterized by the software product's handle, and by the name of the right to be consumed. The license service then attempts to locate one or more valid, correctly bound licenses that contains the named right. If no such license exists, then the software product is notified of the failure. If such licenses exist, then the right is bound to one of the licenses, and the calling software product is notified of the binding. In such a case, the software product knows that the right exists, and can perform whatever functions are associated with this right.


In a preferred embodiment, the license service does not define what the software can or cannot do under the right, or enforce substantive constraints on the use of the software. Rather, the license service manages the licenses in such a way that a software product can determine by calling the API whether a right does, or does not, exist, so that the software can behave accordingly. For example, a right may be called “run,” indicating that the user has the right to run the software product. The software product can use the API to determine whether there is a valid (and correctly bound, and non-expired) right to run the software. However, if the API call returns with an indication that there is no right to run the software, it is up to the software to cease operation or take some other action based on the non-existence of this right.


A right may be associated with information, which becomes available after a successful call to the “consume right” method. For example, a given software product may have individual rules about when it is permissible to edit, print, save, etc., and these rules can be stored in the license that contains the right. The API provides a “get information” method that allows this information to be retrieved from the license.


Other features of the invention are described below.





BRIEF DESCRIPTION OF THE DRAWINGS

The foregoing summary, as well as the following detailed description of preferred embodiments, is better understood when read in conjunction with the appended drawings. For the purpose of illustrating the invention, there is shown in the drawings exemplary constructions of the invention; however, the invention is not limited to the specific methods and instrumentalities disclosed. In the drawings:



FIG. 1 is a block diagram of an example computing environment in which aspects of the invention may be implemented;



FIG. 2 is a block diagram of an architecture in which a system performs licensing functions and exposes an API for use by software products;



FIG. 3 is a flow diagram of a method through which a software product uses a licensing API;



FIG. 4 is a flow diagram of a method by which a software product consumes a right; and



FIG. 5 is a flow diagram of a method by which a software product retrieves information relating to a consumed right.





DETAILED DESCRIPTION OF THE INVENTION
Overview

The use of commercial software is typically governed by a license, and it has become increasingly common for this license to be embodied in an electronic form that can be enforced by the software itself. One challenge in creating an electronic licensing system is that an infrastructure is needed to manage the use of the licenses. Replicating this infrastructure for every software product is cumbersome and wasteful. The present invention provides an API that allows different software products to use a common infrastructure that performs various licensing functions.


Exemplary Computing Arrangement


FIG. 1 shows an exemplary computing environment in which aspects of the invention may be implemented. The computing system environment 100 is only one example of a suitable computing environment and is not intended to suggest any limitation as to the scope of use or functionality of the invention. Neither should the computing environment 100 be interpreted as having any dependency or requirement relating to any one or combination of components illustrated in the exemplary operating environment 100.


The invention is operational with numerous other general purpose or special purpose computing system environments or configurations. Examples of well known computing systems, environments, and/or configurations that may be suitable for use with the invention include, but are not limited to, personal computers, server computers, hand-held or laptop devices, multiprocessor systems, microprocessor-based systems, set top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, embedded systems, distributed computing environments that include any of the above systems or devices, and the like.


The invention may be described in the general context of computer-executable instructions, such as program modules, being executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform particular tasks or implement particular abstract data types. The invention may also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network or other data transmission medium. In a distributed computing environment, program modules and other data may be located in both local and remote computer storage media including memory storage devices.


With reference to FIG. 1, an exemplary system for implementing the invention includes a general purpose computing device in the form of a computer 110. Components of computer 110 may include, but are not limited to, a processing unit 120, a system memory 130, and a system bus 121 that couples various system components including the system memory to the processing unit 120. The processing unit 120 may represent multiple logical processing units such as those supported on a multi-threaded processor. The system bus 121 may be any of several types of bus structures including a memory bus or memory controller, a peripheral bus, and a local bus using any of a variety of bus architectures. By way of example, and not limitation, such architectures include Industry Standard Architecture (ISA) bus, Micro Channel Architecture (MCA) bus, Enhanced ISA (EISA) bus, Video Electronics Standards Association (VESA) local bus, and Peripheral Component Interconnect (PCI) bus (also known as Mezzanine bus). The system bus 121 may also be implemented as a point-to-point connection, switching fabric, or the like, among the communicating devices.


Computer 110 typically includes a variety of computer readable media. Computer readable media can be any available media that can be accessed by computer 110 and includes both volatile and nonvolatile media, removable and non-removable media. By way of example, and not limitation, computer readable media may comprise computer storage media and communication media. Computer storage media includes both volatile and nonvolatile, removable and non-removable media implemented in any method or technology for storage of information such as computer readable instructions, data structures, program modules or other data. Computer storage media includes, but is not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CDROM, digital versatile disks (DVD) or other optical disk storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other medium which can be used to store the desired information and which can accessed by computer 110. Communication media typically embodies computer readable instructions, data structures, program modules or other data in a modulated data signal such as a carrier wave or other transport mechanism and includes any information delivery media. The term “modulated data signal” means a signal that has one or more of its characteristics set or changed in such a manner as to encode information in the signal. By way of example, and not limitation, communication media includes wired media such as a wired network or direct-wired connection, and wireless media such as acoustic, RF, infrared and other wireless media. Combinations of any of the above should also be included within the scope of computer readable media.


The system memory 130 includes computer storage media in the form of volatile and/or nonvolatile memory such as read only memory (ROM) 131 and random access memory (RAM) 132. A basic input/output system 133 (BIOS), containing the basic routines that help to transfer information between elements within computer 110, such as during start-up, is typically stored in ROM 131. RAM 132 typically contains data and/or program modules that are immediately accessible to and/or presently being operated on by processing unit 120. By way of example, and not limitation, FIG. 1 illustrates operating system 134, application programs 135, other program modules 136, and program data 137.


The computer 110 may also include other removable/non-removable, volatile/nonvolatile computer storage media. By way of example only, FIG. 1 illustrates a hard disk drive 140 that reads from or writes to non-removable, nonvolatile magnetic media, a magnetic disk drive 151 that reads from or writes to a removable, nonvolatile magnetic disk 152, and an optical disk drive 155 that reads from or writes to a removable, nonvolatile optical disk 156, such as a CD ROM or other optical media. Other removable/non-removable, volatile/nonvolatile computer storage media that can be used in the exemplary operating environment include, but are not limited to, magnetic tape cassettes, flash memory cards, digital versatile disks, digital video tape, solid state RAM, solid state ROM, and the like. The hard disk drive 141 is typically connected to the system bus 121 through a non-removable memory interface such as interface 140, and magnetic disk drive 151 and optical disk drive 155 are typically connected to the system bus 121 by a removable memory interface, such as interface 150.


The drives and their associated computer storage media discussed above and illustrated in FIG. 1, provide storage of computer readable instructions, data structures, program modules and other data for the computer 110. In FIG. 1, for example, hard disk drive 141 is illustrated as storing operating system 144, application programs 145, other program modules 146, and program data 147. Note that these components can either be the same as or different from operating system 134, application programs 135, other program modules 136, and program data 137. Operating system 144, application programs 145, other program modules 146, and program data 147 are given different numbers here to illustrate that, at a minimum, they are different copies. A user may enter commands and information into the computer 20 through input devices such as a keyboard 162 and pointing device 161, commonly referred to as a mouse, trackball or touch pad. Other input devices (not shown) may include a microphone, joystick, game pad, satellite dish, scanner, or the like. These and other input devices are often connected to the processing unit 120 through a user input interface 160 that is coupled to the system bus, but may be connected by other interface and bus structures, such as a parallel port, game port or a universal serial bus (USB). A monitor 191 or other type of display device is also connected to the system bus 121 via an interface, such as a video interface 190. In addition to the monitor, computers may also include other peripheral output devices such as speakers 197 and printer 196, which may be connected through an output peripheral interface 195


The computer 110 may operate in a networked environment using logical connections to one or more remote computers, such as a remote computer 180. The remote computer 180 may be a personal computer, a server, a router, a network PC, a peer device or other common network node, and typically includes many or all of the elements described above relative to the computer 110, although only a memory storage device 181 has been illustrated in FIG. 1. The logical connections depicted in FIG. 1 include a local area network (LAN) 171 and a wide area network (WAN) 173, but may also include other networks. Such networking environments are commonplace in offices, enterprise-wide computer networks, intranets and the Internet.


When used in a LAN networking environment, the computer 110 is connected to the LAN 171 through a network interface or adapter 170. When used in a WAN networking environment, the computer 110 typically includes a modem 172 or other means for establishing communications over the WAN 173, such as the Internet. The modem 172, which may be internal or external, may be connected to the system bus 121 via the user input interface 160, or other appropriate mechanism. In a networked environment, program modules depicted relative to the computer 110, or portions thereof, may be stored in the remote memory storage device. By way of example, and not limitation, FIG. 1 illustrates remote application programs 185 as residing on memory device 181. It will be appreciated that the network connections shown are exemplary and other means of establishing a communications link between the computers may be used.


Software Licensing Service


FIG. 2 shows an example system that provides a software licensing service 202. Software licensing service 202 operates inside of computer 110 (shown in FIG. 1). In one example, software licensing service 202 is part of an operating system that executes on computer 110. Software licensing service maintains a license store 204 in which license files for software are stored. License files may, for example, be eXtensible Rights Markup Language (XrML) files that specify rights to software, and that also may specify various types of conditions on the exercise of those rights. Software 204 also maintains a trust store 206. Trust store 206 stores un-authenticatable, dynamic data in a tamper-resistant manner; trust store 206 stores data that is used in the license validation process. For example, certain licenses may have expiration dates, and, in order to prevent the expiration data from being circumvented through clock rollback, the current time (and elapsed time) may be periodically stored in trust store 206 to ensure that the clock is always moving forward.


Software licensing service 202 manages license store 204 and trust store 206, and also performs various functions relating to the licensing of software. For example, software licensing service 202 may contain modules that parse license files, modules that enforce the binding of a license to a particular machine and/or to a particular instance of a software product, and a secure timer/counter (that uses trust store 206 in the manner described above).


Software licensing service 202 exposes an application programming interface (API) 208 that allows application software (such as application 135) to use software licensing service 202. Application 135 may invoke the features of software licensing service 208 by making local procedure call (LPC) to the methods of API 208. An example set of API methods that may be exposed by software licensing service 202 is described below.


The manner in which API 208 is used by an application is described with reference to FIG. 3. Initially, the application makes an API call (302). Service 202 then processes the API call (304), and returns the result of the API call to the application 306. For example, an API call may request to exercise (“consume”) a right granted in a license, or to retrieve information from a license. The application then receives the result of the API call, and determines, based on that result, what the application's behavior should be (308). In other words, software licensing service 202, in a preferred embodiment, does not enforce a license directly, but rather provides the infrastructure through which licenses can be managed and used. For example, if an application makes an API call to consume a right and service 202 determines that there is no valid license granting this right, service 202, in a preferred embodiment, does not prevent the application from running, but instead informs the application that the right is not available. Thus, the application can use its own mechanisms to determine what to do in response to the unavailability of the right. This facet of the API provides software vendors the flexibility to decide how the licensing infrastructure provided by service 202 should be used. In another implementation, application can be bound to licensing service functionality.


Example Software Licensing API

The following is an example set of API methods that may be exposed by a software licensing service:


SLOpen

The SLOpen function opens a SL client context handle that must be used for all subsequent SL API calls. (Throughout the example API descriptions, “SL” shall refer to the software licensing service. Thus, the SL client context handle is the handle used by a client in communicating with the software licensing service.)



















HRESULT




SLOpen(




 CONST GUID*   pguidApp,




 HSLC*   phSLC




 );










Parameters


pguidApp


[in] Pointer to application GUID that uniquely identifies an application. If this argument is NULL, an E_INVALIDARG error is returned.


phSLC


[out] SL client context Handle or INVALID_HANDLE_VALUE if failed.


Remarks


Use the SLClose function to close an context handle returned by SLOpen.


Application GUID: Unique ID of application. For the WINDOWS version of the MICROSOFT OFFICE application suite, WinWord has an Application GUID which is different from Excel's Application GUID. For Windows, Windows itself is an application, although it is a composite of many programs.


In Office case, A user can install both Office Suite and WinWord standalone products on the machine. From SL point of view, the WinWord in both products has same Application GUID. WinWord's Application GUID associated to two Product GUID. In other words, WinWord can use either Office Suite's product license or WinWord's product license.


When SLOpen succeeds:


A RPC (remote procedure call) binding has been established.


A context memory is created on SL service. The context is used to keep the status information for the caller of the client.


The SLC handle is like a file handle. A process can open multiple SL context handles but handles are valid within the caller process.


Returns


Success or failure


SLClose

The SLClose function closes an opened SL client context handle. Any information in the context is released automatically.



















HRESULT




SLClose(




 HSLC   hSLC




);










Parameters


hSLC


[in] Handle to current SL client context handle


Remarks


When SLClose is done, the RPC binding is released, and the context is destroyed.


Returns


Success or failure.


SLInstall

The SLInstall function installs applications' licenses and registers applications' information.

















HRESULT SLInstall(











HSLC
hSLC,











CONST SL_PRODKEY*
pAppPrdKey,










DWORD
dwNumOfApps,



CONST GUID*
pguidApps,



DWORD
dwNumOfLicFiles,










PCWSTR
ppszLicFiles[ ],











BOOL
bVerify











);











Parameters


hSLC


[in] Handle to current SL client context handle


pAppPrdKey


[in] Application product key structure. The product key can be Microsoft product key format or Application's product key format.














 typedef struct_tagSL_PRODKEY


 {








  DWORD cb Size;
// Size of SL_PRODKEY


structure









  DWORD dwVersion;
// Version of SL_PRODKEY structure







  WCHAR szProdKey[MAX_PRODKEYSTR_SIZE+1];








  SL_PRODKEY_TYPE eProdKeyType;
// Type of Product key








  SL_CUSTOM_PRODKEY_INFO CustomPrdKeyInfo;
// Customer product key info


 } SL_PRODKEY;









The eProdKeyType can be one of following values:
















SL_PRODKEY_CUSTOM



SL_PRODKEY_MS2002



SL_PRODKEY_MS2003









If the Product Key type is non-MS Product Key (i.e. eProdKeyType==SL_PRODKEY_CUSTOM), the caller has to fill in its custom product key information. If the product uses MS Product Key, then CustomPrdKeyInfo can be ignored.














 typedef struct_tagSL_CUSTOM_PRODKEY_INFO








  DWORD dwSKUID;
// Unique ID for specific SKU, for example







Group ID in MS PID.








  DWORD dwSerialNumber;
// unique serial number, e.g. channel + sequence







number in MS PID.


 } SL_CUSTOM_PRODKEY_INFO;









Current version number of SL_PRODKEY is 1. The caller can use SL_CURRENT_PRODKEY_VERSION in dwVersion field.


dwNumOfApps


[in] The number of application GUID in pguidApps.


pguidApps


[in] A list of application of GUID. The application GUID represents the application that the license is being installed for. For example, Office Setup program can call this function to install the license(s) for Word, Excel by specifying each application GUID in pguidApps. pguidApp cannot be NULL here.


dwNumOfApps


[in] The number of license files.


ppszLicFile


[in] File names in array of strings.


Returns


Success or failure


SLUninstall

The SLUninstall function uninstalls a product's license from an application.
















HRESULT SLUninstall (










 HSLC
hSLC,









 CONST SL_PRODKEY* pAppPrdKey



);









Parameters


hSLC


[in] Handle to current SL client context handle


pAppPrdKey


[in] See above definition in connection with SLInstall.


Remarks


An application could have more than one product licenses. For example, when the user uninstalls Office suite, the association between Office Suite license and WinWord should be removed, but the license from WinWord Standalone product should not be removed.


When SLUninstall succeeds:


The information associated with this Product Key is removed. (see SLInstall, above, for the associated information)


The product keys associated with the Application GUID is removed.


The license files associated with the product GUID are preferably still kept.


Returns


Success or failure


SLConsumeRight

The SLConsumeRight function lets an application to examine or exercise the rights on a locally-stored license. Calling this function binds a license to the right mentioned in pszRightName. If this right cannot be exercised by the current caller, then the application fails. If the function succeeds, the action associated with the right can be executed (like decreasing usage count, decreasing time quota, or nothing)
















HRESULT SLConsumeRight(










 HSLC
hSLC,










 PCWSTR
pszRightName,










 SL_ASYNC_CONTEXT*
pAsyncContext









};









Parameters


hSLC


[in] Handle to current SL client context handle


pszRightName


[in] The name of right needs to be evaluated. In current design, the right name is defined by applications. SL opens the license and evaluates the condition based on the right name.


pAsyncContext


[in/out] If pAsyncContext is NULL, this function works in synchronous mode, otherwise, the function works in asynchronous mode. SL_ASYNC_CONTEXT is opaque to caller and managed by SLC.


Remarks


All licenses associated with the application GUID (specified in SLOpen) will be conceptually combined in one logic license.


If their are multiple consumable grants of the right, then the license with higher priority will be consumed first.


Returns


Success or failure


SLInitializeAsyncContext

The SLInitializeAsyncContext function initializes the asynchronous context for SLC functions to make asynchronous call.














HRESULT SLInitializeAsyncContext(








 SL_ASYNC_CONTEXT*pAsyncContext,
// asynchronous context


 HANDLE hEvent,
// event handle








 PVOID pvReserved
// reserved, NULL







};









Parameters


pAsyncContext


[in/out] pointer to asynchronous context that contains asynchronous call information.


hEvent


[in] The event object used for synchronization.


pvReserved


[in] reserved for extension.


Returns


Success or failure.


SLCancelAsyncCall

The SLCancelAsyncCall function is used to cancel an asynchronous call.














HRESULT SLCancelAsyncCall(









 SL_ASYNC_CONTEXT*
pAsyncContext,
// asynchronous context









 BOOL
fAbortCall
// cancel immediately







};









Parameters


pAsyncContext


[in] asynchronous context for SL asynchronous call.


fAbortCall


[in] If TRUE, the call is cancelled immediately. If FALSE, wait for the SL to complete the call.


Remarks


There are two ways for the caller to request cancellation of an asynchronous call—abortive and nonabortive. In an abortive cancel (fAbortCall is TRUE), the SLCancelAsyncCall function sends a cancel notification to the SLC and the asynchronous call is canceled immediately, without waiting for a response from the SLC. In a nonabortive cancel (fAbortCall is FALSE) the SLCancelAsyncCall function notifies SLC of the cancel and the caller waits for SLC to complete the call.


Returns


Success or failure.


SLCompleteAsyncCall

The SLCompleteAsyncCall function is used to complete an SLC asynchronous call.














 HRESULT SLCompleteAsyncCall(









  SL_ASYNC_CONTEXT*
pAsyncContext,
// asynchronous context









  HRESULT*
phrAsyncCall
// error code of the submitted







asynchronous call


 };









Parameters


pAsyncContext


[in] asynchronous context for SL asynchronous call.


phrAsyncCall


[out] the error code of the submitted asynchronous call.


Remarks


If the caller calls this function before the reply has arrived, the call returns E_SLC_ASYNC_CALL_PENDING. The buffer must be valid and it must be big enough to receive the return value. If the call does not return E_SLC_ASYNC_CALL_PENDING, this SLCompleteAsyncCall invocation is final for the asynchronous call. After this function call, regardless of success or failure, all resources allocated for this asynchronous call are freed. (Subsequent calls to the SLCompleteAsyncCall or SLCancelAsyncCall functions have undefined results until a new call on the SL_ASYNC_CONTEXT structure is initiated).


Returns













Value
Meaning







S_OK
The call was completed



successfully.


E_SLC_INVALID_ASYNC_CONTEXT
The asynchronous call



context is not valid.


E_SLC_ASYNC_CALL_PENDING
The call has not yet



completed.


E_SLC_CALL_CANCELLED
The call was cancelled.









SLGetInformation

The SLGetLicenseInfo function is used to get a variety of information.














HRESULT SLGetInfomation(









 HSLC
hSLC,
// SL client context handle









 DWORD
dwCategory,
// The category of information to retrieve









 PCWSTR
pszKeyName,
// Name of the Key









 DWORD*
pdwType,
// Type of value


 SIZE_T*
pcbValue,
// Size of value


 PBYTE*
ppbValue
// Pointer to buffer of value







);









Parameters


hSLC


[in] Handle to current SL client context handle


dwCategory


[in] The category of information.













Category
Meaning







SL_CAT_RIGHTDATA
Get the information from bound right. The license has to



be consumed successfully before getting these right data.


SL_CAT_DYNAMICPROPERTY
Get the information that is not in the license but



calculating in the run-time. For example,



RemainingGracePeriodDays. The right has to be



consumed before calling.













Name
Meaning







RemainingGracePeriod
The grace period is defined in



Days:DWORD
out-of-box license. Once the




application is installed, the time




is counting down. Applications




can check remaining grace




period after they have




consumed license.



ActivationStatus:
After applications consumed



DWORD
license, it can get consumed




license type. The return value




could be:










SL_LIC_OOB
The




consumed




license is out-




of-box license.



SL_LIC_ACQUIRED
The




consumed




license is




acquired




license.



SL_LIC_NONE
No license is




available.












SL_CAT_SERVICEINFO
Get the information that is not dependent on license. The



caller can get this category of information without



consuming license.













Name
Meaning







SLVersion:
The version of SL. 1.2.3.4



DWORD
format.



HWID:BINARY
Current HWID












SL_CAT_WINDOWSINFO
Get information that is bound right property in Windows



license. This is for Componentization. Windows License



has been consumed by SL service and SL service keeps the



bound right properties.


SL_CAT_ENUMLICINFO
When SLEnumLicenseis called and is succeed, the caller



can query the information of enumerated license by using



this category.









pszKeyName


[in] the name of the key. E.g. BuildNumber


pdwType


[out] type of data
















Value
Meaning









SL_DATATYPE_SZ
Unicode string



SL_DATATYPE_DWORD
DWORD



SL_DATATYPE_BINARY
Binary










pcbValue


[out] Size of the buffer allocated (in bytes).


ppbValue


[out] If successful, the data is returned in the buffer allocated by SLC. The caller has to call SLFreeMemory to free the memory.


Returns


Success or failure


SLAcquireLicense

The SLAcquireLicense function is used to acquire on-line license for the user. SLC enumerates the product keys associated with the Application and picks up the product key with highest product priority (see SLInstall, registration information). Then SL gets the clearing house URL from out-of-box license and connects to clearing house to get a license.


SLAcquireLicense could be a lengthy process. Applications can call this function in asynchronous mode by specifying pAsyncContext (NULL means synchronous mode).














HRESULT SLAcquireLicense(









 HSLC
hSLC,
// SL client context handle









 PCWSTR
pszProdKeyHash,
// hash of product key









 PCWSTR
pszPublishLicense,
// string of publishing license.








 SL_ASYNC_CONTEXT*
pAsyncContext







);









Parameters


hSLC


[in] Handle to current SL client context handle


pszProdKeyHash


[in] string of product key hash. The product key hash is created when SLInstall is called and is maintained by the licensing service.


pszPublishingLicense


[in] string of publishing license.


pAsyncContext


[in] asynchronous context for SL asynchronous call.


Remarks


The acquired license will be stored in license store accordingly and the license information will be registered, too. (see SLInstall)


Applications might need to add more client information to license. The application can put the information to pbAppData in the call and this data will be sent to clearing house.


When this function succeeds:


It sent necessary binding information to the specified license server.


It receives the license from license server.


It stored the license in license store. See description of SLInstall, above, for how the license file is stored.


Returns


Success or failure.


SLGenerateTextChallenge

Generates and installation challenge text to be routed to a license issuer in an out of band fashion (telephone, email, file share, etc).














HRESULT SLGenerateTextChallenge(









 HSLC
hSLC,
// SL client context handle









 PCWSTR
pszProdKeyHash,
// string of product key hash









 BOOL
fSingleSession,
// Single session only?









 PWSTR
*ppszChallenge
// Pointer to buffer to hold challenge text







);









Parameters


hSLC


[in] Handle to current SL client context handle


pszProdKeyHash


[in] String of product key hash. The product key hash is created when SLInstall is called and maintained by the licensing service.


bSingleSession


[in] Specifies whether or not the corresponding text response from the license issue will be valid only for the lifetime of this SLC session handle.


ppszChallenge


[out] If successful, the text challenge is returned in the buffer allocated by SLC. The caller needs to call SLFreeMemory to free the allocated memory.


Returns


Success or failure.


SLDepositTextResponse

Deposits the response to an installation challenge text in the licensing system. Used to activate a license with a conditional access code. Only valid if there is an outstanding text challenge which has been issued for a license. If the original license specified that the challenge was only valid for a single session, this API must be called with the response before the SLC handle is closed or depositing the response will fail.














HRESULT SLDepositTextResponse(









 HSLC
hSLC,
// SL client context handle








 PCWSTR
pszProdKeyHash,









 PWSTR
pszResponse
// Buffer containing response text







);









Parameters


hSLC


[in] Handle to current SL client context handle


pszProdKeyHash


string of the product key hash


pszChallenge


[in] Response text


Returns


Success or failure.


SLEnumLicense

The SLEnumLicensefunction is used to enumerate installed licenses and get information from the license.














HRESULT SLEnumLicense(









 HSLC
hSLC,
// SL client context handle









 CONST GUID*
pguidApp,
// application GUID









 DWORD
dwIndex
// index number







);









Parameters


hSLC


[in] Handle to current SL client context handle


pguidApp


[in] See SLInstall. If pguidApp is not NULL, then licenses associated with this GUID are enumerated. If the GUID is NULL, then all licenses are enumerated.


dwIndex


[in] The index number of the license to be retrieved. This value should be zero for the first call to the SLEnumLicense function and then incremented for subsequent calls.


The function may return licenses in any order.


Returns


E_SL_NO_MORE_DATA—No license at the specified index.


Remarks


If SLEnumLicenses succeeded, the selected license information can be accessed by calling SLGetInformation and the category is SL_CAT_ENUMLICINFO


Sample:
















DWORD i=0;



PBYTE pbProductPriority = NULL;



PBYTE pbRemainingGracePeriodDays = NULL;



for (i=0; ; i++)



{



 EXIT_ON_ERROR(SLEnumLicense(hSLC, NULL, dwIndex));



if (E_SL_NO_MORE_DATA == SCODE(hr))



{



 hr = S_OK;



 break;



}









EXIT_ON_ERROR(SLGetInformation(hSLC, SL_CAT_ENUMLIC, “ProductPriority”, &dwType, &cbProductPriority, &pbProductPriority));


EXIT_ON_ERROR(SLGetInformation(hSLC, SL_CAT_ENUMLIC, “RemainingGracePeriodDays”, &dwType, &cbRemainingGracePeriodDays, &pbRemainingGracePeriodDays));


Exit:
















 SLFreeMemory(pbProductPriority);



 SLFreeMemory(pbRemainingGracePeriodDays);



}









SLFreeMemory

The SLFreeMemory function is used to free the memory allocated by SLC.
















VOID SLFreeMemory(











 PVOID
pvMemblock,
// pointer to memory









);









Parameters


pvMemBlock


[in] Previously allocated memory block to be freed


Returns


None


Use of Software Licensing API to Control Use of Software

A software product uses the API of the present invention for various purposes related to licensing, including the consumption of rights in a license, and the retrieval of data from the license. As noted above, the API allows the software to determine what rights are present in the license, but, preferably, it is up to the software to determine what to do with that information—e.g., grant or deny access to a feature, cease operation altogether, etc. The following description of FIGS. 4 and 5 show how the API of the present invention is used by a software product.



FIG. 4 shows an example process by which an application “consumes” a right. The application calls the SLConsumeRight method (402). As discussed above, the arguments to the SLConsumeRight function include the client handle assigned by the licensing service, and the name of the right (which is assigned by the vendor of the software to which the right pertains). The licensing service (service 202, shown in FIG. 2) receives the call (404). The service then locates licenses that contains the right, and checks the licenses bindings and validity. As noted above, the license is located in the license store; if there is more than one license that pertains to the application software to which the SLConsumeRight call pertains, then a priority rule may be used to select one of the applicable licenses. Checking the binding means determining that: (1) the license is bound to the product key of the application identified by the client handle; and (2) the license is bound to the machine on which the software is running (or to the group of machines of which the current machine is a member). Checking validity may include determining that the right has not expired (in the case of licenses that specify an expiration date), and that the maximum number of uses of the right is not exceeded (in the case where the license specifies a maximum number of times that the right may be used (i.e., “consumed”)).


If the license and/or right are found to be correctly bound and valid (408), then the license is bound to the right requested in the API call (412). (It should be noted that “binding” a license to a machine, environment, and a product key means that the license specifies which machine(s) and product key it can be used with; “binding” a license to a right means that the consume function has been successful, and the right is being consumed from a particular license. Throughout this description, it will be clear from context which meaning of “binding” applies.) The API call then returns to the calling application and indicates that the call was successful (414). If the license and/or right has been found to be invalid, or not correctly bound to the machine, environment, or product ID, then the SLConsumeRight call returns to the calling application and indicates that the operation failed (410).


If the SLConsumeRight call returns with a failure, then the right specified in the call cannot be consumed from a license, and no information about that right will be available to the calling application. However, if the right is successfully consumed, then the application can use the binding of the right to the license to get information from the license about the right. For example, a license may contain a general right called “run,” which indicates that the application may be run. However, for the “run” right, the license may contain more specific parameters about the usage of the application—e.g., the license may specify whether particular features of an application (e.g., print, edit, save, etc.) should be turned on or off, and may give specific parameters for the use of these features (e.g., the document can be saved only on machines that are running in a particular domain, or the print feature can only be used for thirty days, etc.). The SL API does not require any particular type of information to be associated with a right, but rather provides a mechanism whereby an application vendor can associate any type of information with a right, which can then be retrieved and interpreted by the application.


Assuming that a right has been successfully consumed as described in FIG. 4, the application may then retrieve the information associated with the right. The process of retrieving this information is described in FIG. 5.


First, the application calls the SLGetInformation method on the bound right (502). The various types of information that can be retrieved are described above in connection with the description of the SLGetInformation method. The licensing service then receives the call (504). The service retrieves the requested information from the license file that contains the bound right (506). The licensing service then places this information in a buffer (508), and returns to the calling application (510). The calling application then reads the contents of the buffer, and performs whatever actions it deems necessary based on the retrieved information.


It should be noted that the licensing service may not be aware of the meaning of the information that it is handling as part of an SLGetInformation call. As discussed above, the licensing framework provides a mechanism whereby a software vendor can create rights, and can associate information with the rights. The invention is not limited either to any particular type of information that can be associated with the right. When the information is retrieved from the license, it is simply passed by the licensing service to the application in a buffer. The application then interprets the retrieved information, decides what actions to be taken based on that information, and uses its own security features to enforce the application's decision. (E.g., if, based on the retrieved information, the application decides to disable the print feature, the application contains the code that actually disables this features and, possibly, code that prevents a hacker from tampering with the disabling of the print feature.)


It is noted that the foregoing examples have been provided merely for the purpose of explanation and are in no way to be construed as limiting of the present invention. While the invention has been described with reference to various embodiments, it is understood that the words which have been used herein are words of description and illustration, rather than words of limitations. Further, although the invention has been described herein with reference to particular means, materials and embodiments, the invention is not intended to be limited to the particulars disclosed herein; rather, the invention extends to all functionally equivalent structures, methods and uses, such as are within the scope of the appended claims. Those skilled in the art, having the benefit of the teachings of this specification, may effect numerous modifications thereto and changes may be made without departing from the scope and spirit of the invention in its aspects.

Claims
  • 1-20. (canceled)
  • 21. An apparatus comprising: at least one computer processor;a license store that stores license files for different software products, said license files including licenses to the different software products specifying rights and conditions on the exercise of said rights; andmemory coupled to the at least one computer processor, the memory comprising executable instructions that, based on execution by the at least one computer processor, cause the at least one computer processor to automatically: expose an application programming interface that provides access by application programs to license information associated with the different software products in said license files in said license store;receive from an application program via said application programming interface a request comprising an indication of a software product and a request to exercise a right granted in a license to the software product in said license files;check whether the license for the indicated software product is valid;based at least on the license for the indicated software product being valid, obtaining from said license store rights and conditions of the exercise of said rights granted in the license for the software product indicated in the request; andprovide, based at least on receiving the request via said application programming interface, the rights and conditions of the exercise of said rights granted in the license for the software product indicated in the request to the application program without implementing any mechanism for granting or denying the rights granted in the license for the software product, wherein the instructions for checking whether the license for the indicated software product is valid further comprises instructions for determining that the license for the indicated software product is bound to the software product by determining whether the rights granted in the license for the software product indicated in the request can be exercised based on whether the rights are bound to an entity for which execution of the application program was requested, wherein the instructions further comprise instructions for establishing a context for asynchronous processing and processing the request from the application program, asynchronously, in accordance with the established context, and wherein the executable instructions are executed by an operating system.
  • 22. The apparatus of claim 21, further comprising a trust store that stores data used in a license validation process in a tamper-resistant manner.
  • 23. The apparatus of claim 21, wherein the instructions for checking that the license for the indicated software product is valid includes instructions for determining, via a conflict rule, which license to obtain from a plurality of licenses indicated by said license files that are stored in the license store for the software product, the plurality of licenses including the license to the software product.
  • 24. The apparatus of claim 21, wherein the rights and conditions of the exercise of said rights granted in the license for the software product indicated in the request comprise an indication of a validity of the rights granted in the license for the software product.
  • 25. The apparatus of claim 21, wherein the instructions for obtaining said license store rights and conditions of the exercise of said rights includes instructions for determining whether the license for the indicated software product is valid and bound to the software product, and for obtaining said license store rights and conditions of the exercise of said rights granted in the license for the software product indicated in the request when said license store rights and conditions of the exercise of said rights granted in the license for the software product indicated in the request is valid and bound to the software product.
  • 26. The apparatus of claim 21, wherein instructions for providing the rights and conditions of the exercise of said rights includes instructions for providing the rights and conditions of the exercise of said rights granted in the license for the software product indicated in the request or the information from the license to the software product indicated in the request to the application software without implementing any mechanism for granting or denying the rights granted in the license for the software product.
  • 27. A method comprising: exposing an application programming interface that provides access by application programs to license information in a license store storing license files for different software products, said license files including licenses to the different software products specifying rights and conditions on the exercise of said rights;receiving from an application program via said application programming interface a request comprising an indication of a software product having a license file in the license store and a request to exercise a right granted in a license to the software product in said license files;checking whether the license for the indicated software product is valid;based at least on the license for the indicated software product being valid, obtaining from said license store rights and conditions of the exercise of said rights granted in the license for the software product indicated in the request;providing, based at least on receiving the request via said application programming interface, the rights and conditions of the exercise of said rights granted in the license for the software product indicated in the request to the application program without implementing any mechanism for granting or denying the rights granted in the license for the software product, wherein checking whether the license for the indicated software product is valid further comprises determining that the license for the indicated software product is bound to the software product by determining whether the rights granted in the license for the software product indicated in the request can be exercised;establishing a context for asynchronous processing; andprocessing the request from the application program, asynchronously, in accordance with the established context, wherein the method is executed by an operating system.
  • 28. The method of claim 27, further comprising storing data used in a license validation process in a trust store in tamper-resistant manner.
  • 29. The method of claim 27, wherein checking that the license for the indicated software product is valid includes determining, via a conflict rule, which license to obtain from a plurality of licenses in said license files that are stored in the license store for the software product, the plurality of licenses including the license to the software product.
  • 30. The method of claim 27, wherein the rights and conditions of the exercise of said rights granted in the license for the software product indicated in the request comprise an indication of a validity of the rights granted in the license for the software product.
  • 31. The method of claim 27, wherein the license files further specify at least one condition on the exercise of the right granted in the license.
  • 32. The method of claim 27, wherein the obtaining rights and conditions of the exercise of said rights further comprises determining whether the license for the indicated software product is valid and bound to the software product, and obtaining rights and conditions of the exercise of said rights granted in the license for the software product indicated in the request when rights and conditions of the exercise of said rights granted in the license for the software product indicated in the request is valid and bound to the software product.
  • 33. A computer-readable memory device comprising executable instructions that, based on execution by at least one computer processor, cause the at least one computer processor to: expose an application programming interface that allows application programs to request license information contained in a license store storing license files for different software products, said license files including licenses to the different software products specifying at least one right;receive from an application program at least via said application programming interface a request comprising an indication of a software product having a license file in the license store and a request to exercise a right granted in a license to the software product in said license files;check whether the license for the indicated software product is valid;based at least on the license for the indicated software product being valid, obtain from said license store the at least one right granted in the license for the software product indicated in the request;provide, based at least on receiving the request via said application programming interface, the at least one right granted in the license for the software product indicated in the request to the application program without implementing any mechanism for granting or denying the rights granted in the license for the software product, wherein checking whether the license for the indicated software product is valid further comprises determining that the license for the indicated software product is bound to the software product by determining whether the rights granted in the license for the software product indicated in the request can be exercised based on whether the rights are bound to an entity associated with the received request;establishing a context for asynchronous processing; andprocessing the request from the application program, asynchronously, in accordance with the established context, wherein the instructions are executed by an operating system.
  • 34. The memory device of claim 33, further comprising instructions for storing data used in a license validation process in a trust store in tamper-resistant manner.
  • 35. The memory device of claim 33, wherein instructions for checking that the license for the indicated software product is valid includes instructions for determining, via a conflict rule, which license to obtain from a plurality of licenses in said license files that are stored in the license store for the software product, the plurality of licenses including the license to the software product.
  • 36. The memory device of claim 33, wherein instructions to check whether the license for the indicated software product is valid comprises instructions that further cause the at least one processor to determine whether the rights granted in the license for the software product indicated in the request can be exercised based on whether rights are bound to a class of machines of which a machine executing the application program from which the request was received is a member.
  • 37. The memory device of claim 33, wherein the license files further specify at least one condition on the exercise of said at least one right.
  • 38. The memory device of claim 33, wherein the check further comprises checking whether the license for the indicated software product is bound to the software product.
  • 39. The memory device of claim 33, wherein the obtaining the at least one right further comprises determining whether the license for the indicated software product is valid and bound to the software product, and obtaining the at least one right and conditions of the exercise of said at least one right granted in the license for the software product indicated in the request when the at least one right and conditions of the exercise of said at least one right granted in the license for the software product indicated in the request is valid and bound to the software product.
  • 40. The memory device of claim 39, wherein providing the at least one right based at least on receiving the request, further comprises providing the at least one right and the conditions of the exercise of said at least one right granted in the license for the software product indicated in the request or the information from the license to the software product indicated in the request to the application software without implementing any mechanism for granting or denying the rights granted in the license for the software product.
CROSS-REFERENCE TO RELATED APPLICATION(S)

This application is a continuation of U.S. patent application Ser. No. 10/692,868, filed Oct. 24, 2003, entitled “PROGRAMMING INTERFACE FOR LICENSING,” (Atty. Dkt. No. 305442-US-NP). The entirety of this afore-mentioned application is incorporated herein by reference.

Continuations (1)
Number Date Country
Parent 10692868 Oct 2003 US
Child 16590853 US